Thread (7 messages) 7 messages, 2 authors, 2021-05-25

[PATCH 1/2] net: phy: fix yt8511 clang uninitialized variable warning

From: Peter Geis <hidden>
Date: 2021-05-25 12:28:40
Also in: lkml
Subsystem: ethernet phy library, motorcomm phy driver, networking drivers, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, Frank, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

clang doesn't preinitialize variables. If phy_select_page failed and
returned an error, phy_restore_page would be called with `ret` being
uninitialized.
Even though phy_restore_page won't use `ret` in this scenario,
initialize `ret` to silence the warning.

Fixes: b1b41c047f73 ("net: phy: add driver for Motorcomm yt8511 phy")
Reported-by: kernel test robot <redacted>
Signed-off-by: Peter Geis <redacted>
---
 drivers/net/phy/motorcomm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
index 796b68f4b499..5795f446c528 100644
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -51,7 +51,7 @@ static int yt8511_write_page(struct phy_device *phydev, int page)
 static int yt8511_config_init(struct phy_device *phydev)
 {
 	unsigned int ge, fe;
-	int ret, oldpage;
+	int oldpage, ret = 0;
 
 	/* set clock mode to 125mhz */
 	oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE);
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help