linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe
@ 2017-12-06 23:07 Branislav Radocaj
  2017-12-07 18:52 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Branislav Radocaj @ 2017-12-06 23:07 UTC (permalink / raw)
  To: heiko, netdev
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel, Branislav Radocaj

If clk_set_rate() fails, we should disable clk before return.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Branislav Radocaj <branislav@radocaj.org>
---
 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

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

* Re: [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe
  2017-12-06 23:07 [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe Branislav Radocaj
@ 2017-12-07 18:52 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-12-07 18:52 UTC (permalink / raw)
  To: branislav; +Cc: heiko, netdev, linux-arm-kernel, linux-rockchip, linux-kernel

From: Branislav Radocaj <branislav@radocaj.org>
Date: Thu,  7 Dec 2017 00:07:38 +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 <branislav@radocaj.org>

Ok, but this probe routine is very inconsistent in how it handles
clock rate setting failures now.

Above your changes, if the RGMII clk can't have it's rate set, we
just continue.

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

* Re: [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe
  2017-12-06 17:24 Branislav Radocaj
@ 2017-12-06 20:46 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-12-06 20:46 UTC (permalink / raw)
  To: branislav; +Cc: heiko, netdev, linux-arm-kernel, linux-rockchip, linux-kernel

From: Branislav Radocaj <branislav@radocaj.org>
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 <branislav@radocaj.org>

Please eliminate this indentation of your commit message and
resubmit.

Thank you.

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

* [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe
@ 2017-12-06 17:24 Branislav Radocaj
  2017-12-06 20:46 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Branislav Radocaj @ 2017-12-06 17:24 UTC (permalink / raw)
  To: heiko, netdev
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel, Branislav Radocaj

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

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

    Signed-off-by: Branislav Radocaj <branislav@radocaj.org>
---
 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

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

end of thread, other threads:[~2017-12-07 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 23:07 [PATCH] net: ethernet: arc: fix error handling in emac_rockchip_probe Branislav Radocaj
2017-12-07 18:52 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2017-12-06 17:24 Branislav Radocaj
2017-12-06 20:46 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).