[lvc-project] [PATCH] net: dsa: add return value check of genphy_read_status()
Alexandra Diupina
adiupina at astralinux.ru
Thu Mar 14 09:30:08 MSK 2024
Need to check return value of genphy_read_status(),
because higher in the call hierarchy is the
dsa_register_switch() function,
which is used in various drivers.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 33615367f378 ("net: dsa: Support internal phy on 'cpu' port")
Signed-off-by: Alexandra Diupina <adiupina at astralinux.ru>
---
net/dsa/port.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index c42dac87671b..c411f30bb5f6 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -1765,7 +1765,9 @@ static int dsa_shared_port_fixed_link_register_of(struct dsa_port *dp)
mode = PHY_INTERFACE_MODE_NA;
phydev->interface = mode;
- genphy_read_status(phydev);
+ err = genphy_read_status(phydev);
+ if (err)
+ return err;
if (ds->ops->adjust_link)
ds->ops->adjust_link(ds, port, phydev);
--
2.30.2
More information about the lvc-project
mailing list