net: stmicro: fix a missing check of clk_prepare
authorKangjie Lu <kjlu@umn.edu>
Wed, 26 Dec 2018 02:57:14 +0000 (20:57 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:37:49 +0000 (15:37 +0100)
[ Upstream commit f86a3b83833e7cfe558ca4d70b64ebc48903efec ]

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

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c

index d07520fb969e687aa6ee5c384c7e23ecf3a8e38a..62ccbd47c1db2b60319051718a51fe159d2e7a54 100644 (file)
@@ -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;