[PATCH] net: stmicro: fix a missing check of clk_prepare

Subsystems: networking drivers, stmmac ethernet driver, the rest

STALE2817d

2 messages, 2 authors, 2018-12-28 · open the first message on its own page

[PATCH] net: stmicro: fix a missing check of clk_prepare

From: Kangjie Lu <hidden>
Date: 2018-12-26 02:57:45

clk_prepare() could fail, so let's check its status, and if it fails,
return its error code upstream.

Signed-off-by: Kangjie Lu <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
index d07520fb969e..62ccbd47c1db 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
@@ -59,7 +59,9 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
 		gmac->clk_enabled = 1;
 	} else {
 		clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE);
-		clk_prepare(gmac->tx_clk);
+		ret = clk_prepare(gmac->tx_clk);
+		if (ret)
+			return ret;
 	}
 
 	return 0;
-- 
2.17.2 (Apple Git-113)

Re: [PATCH] net: stmicro: fix a missing check of clk_prepare

From: David Miller <davem@davemloft.net>
Date: 2018-12-28 00:21:11

From: Kangjie Lu <redacted>
Date: Tue, 25 Dec 2018 20:57:14 -0600
clk_prepare() could fail, so let's check its status, and if it fails,
return its error code upstream.

Signed-off-by: Kangjie Lu <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help