mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: dsa: add return value check of genphy_read_status()
@ 2024-03-14  6:30 Alexandra Diupina
  2024-03-14 13:02 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandra Diupina @ 2024-03-14  6:30 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Alexandra Diupina, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Sebastian Reichel, netdev, linux-kernel, lvc-project

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@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-27 14:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14  6:30 [PATCH] net: dsa: add return value check of genphy_read_status() Alexandra Diupina
2024-03-14 13:02 ` Andrew Lunn
2024-03-15 10:25   ` Александра Дюпина
2024-03-20 23:48     ` Florian Fainelli
2024-03-21 12:06       ` Alexandra Diupina
2024-03-27 14:08         ` [lvc-project] " Alexandra Diupina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®