Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | From | Jerry Ray <> | Subject | [net-next: PATCH v7 3/7] dsa: lan9303: Add exception logic for read failure | Date | Tue, 17 Jan 2023 14:56:59 -0600 |
| |
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> --- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 63f5c1ef65e2..66466d50d015 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -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, ®); + ret = lan9303_read(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, ®); + if (ret) + return (ret); reg &= ~LAN9303_VIRT_SPECIAL_TURBO; regmap_write(chip->regmap, LAN9303_VIRT_SPECIAL_CTRL, reg); -- 2.17.1
| ![\](/images/icornerr.gif) |