[PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe

Subsystems: arm/rockchip soc support, networking drivers, the rest

STALE3235d

2 messages, 2 authors, 2017-12-06 · open the first message on its own page

[PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe

From: Branislav Radocaj <hidden>
Date: 2017-12-06 17:33:34

    If clk_set_rate() fails, we should disable clk
    before return.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Branislav Radocaj [off-list ref]
---
 drivers/net/ethernet/arc/emac_rockchip.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index e278e3d96ee0..c6163874e4e7 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -220,9 +220,11 @@ static int emac_rockchip_probe(struct platform_device *pdev)
 
 		/* RMII TX/RX needs always a rate of 25MHz */
 		err = clk_set_rate(priv->macclk, 25000000);
-		if (err)
+		if (err) {
 			dev_err(dev,
 				"failed to change mac clock rate (%d)\n", err);
+			goto out_clk_disable_macclk;
+		}
 	}
 
 	err = arc_emac_probe(ndev, interface);
@@ -232,7 +234,8 @@ static int emac_rockchip_probe(struct platform_device *pdev)
 	}
 
 	return 0;
-
+out_clk_disable_macclk:
+	clk_disable_unprepare(priv->macclk);
 out_regulator_disable:
 	if (priv->regulator)
 		regulator_disable(priv->regulator);
-- 
2.11.0

Re: [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe

From: David Miller <davem@davemloft.net>
Date: 2017-12-06 20:46:27

From: Branislav Radocaj <redacted>
Date: Wed,  6 Dec 2017 18:24:33 +0100
    If clk_set_rate() fails, we should disable clk
    before return.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Branislav Radocaj [off-list ref]
Please eliminate this indentation of your commit message and
resubmit.

Thank you.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help