]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
dsa: lan9303: Add exception logic for read failure
authorJerry Ray <jerry.ray@microchip.com>
Tue, 17 Jan 2023 20:56:59 +0000 (14:56 -0600)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Jan 2023 08:53:13 +0000 (08:53 +0000)
While it is highly unlikely a read will ever fail, This code fragment is
now in a function that allows us to return an error code. A read failure
here will cause the lan9303_probe to fail.

Signed-off-by: Jerry Ray <jerry.ray@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/lan9303-core.c

index 63f5c1ef65e264939f03b26deea22c0b23d96f50..66466d50d0156c3eb2d589efe5df331971419dc8 100644 (file)
@@ -911,7 +911,9 @@ static int lan9303_setup(struct dsa_switch *ds)
        }
 
        /* Virtual Phy: Remove Turbo 200Mbit mode */
-       lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, &reg);
+       ret = lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, &reg);
+       if (ret)
+               return (ret);
 
        reg &= ~LAN9303_VIRT_SPECIAL_TURBO;
        regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg);