net: ks8851: Reassert reset pin if chip ID check fails [Linux 5.1]

net: ks8851: Reassert reset pin if chip ID check fails [Linux 5.1]

This Linux kernel change "net: ks8851: Reassert reset pin if chip ID check fails" is included in the Linux 5.1 release. This change is authored by Lukas Wunner <lukas [at] wunner.de> on Wed Mar 20 15:02:00 2019 +0100. The commit for this change in Linux stable tree is 761cfa9 (patch).

net: ks8851: Reassert reset pin if chip ID check fails

Commit 73fdeb82e963 ("net: ks8851: Add optional vdd_io regulator and
reset gpio") amended the ks8851 driver to briefly assert the chip's
reset pin on probe. It also amended the probe routine's error path to
reassert the reset pin if a subsequent initialization step fails.

However the commit misplaced reassertion of the reset pin in the error
path such that it is not performed if the check of the Chip ID and
Enable Register (CIDER) fails. The error path is therefore slightly
asymmetrical to the probe routine's body. Fix it.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Frank Pavlic <f.pavlic@kunbus.de>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/micrel/ks8851.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index a93f8e8..1633fa5 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1554,9 +1554,9 @@ static int ks8851_probe(struct spi_device *spi)
    free_irq(ndev->irq, ks);

 err_irq:
+err_id:
    if (gpio_is_valid(gpio))
        gpio_set_value(gpio, 0);
-err_id:
    regulator_disable(ks->vdd_reg);
 err_reg:
    regulator_disable(ks->vdd_io);

Leave a Reply

Your email address will not be published. Required fields are marked *