linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe()
@ 2019-02-15 21:20 Alexey Khoroshilov
  2019-02-16  8:17 ` Sergei Shtylyov
  2019-02-17 23:44 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2019-02-15 21:20 UTC (permalink / raw)
  To: Sebastian Hesselbarth, David S. Miller
  Cc: Alexey Khoroshilov, netdev, linux-kernel, ldv-project

If mv643xx_eth_shared_of_probe() fails, mv643xx_eth_shared_probe()
leaves clk undisabled.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 2f427271a793..292a668ce88e 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2879,7 +2879,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 
 	ret = mv643xx_eth_shared_of_probe(pdev);
 	if (ret)
-		return ret;
+		goto err_put_clk;
 	pd = dev_get_platdata(&pdev->dev);
 
 	msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
@@ -2887,6 +2887,11 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 	infer_hw_params(msp);
 
 	return 0;
+
+err_put_clk:
+	if (!IS_ERR(msp->clk))
+		clk_disable_unprepare(msp->clk);
+	return ret;
 }
 
 static int mv643xx_eth_shared_remove(struct platform_device *pdev)
-- 
2.7.4


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

* Re: [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe()
  2019-02-15 21:20 [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Alexey Khoroshilov
@ 2019-02-16  8:17 ` Sergei Shtylyov
  2019-02-17 23:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2019-02-16  8:17 UTC (permalink / raw)
  To: Alexey Khoroshilov, Sebastian Hesselbarth, David S. Miller
  Cc: netdev, linux-kernel, ldv-project

On 16.02.2019 0:20, Alexey Khoroshilov wrote:

> If mv643xx_eth_shared_of_probe() fails, mv643xx_eth_shared_probe()
> leaves clk undisabled.

    Enabled, that is? :-)

> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
[...]

MBR, Sergei

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

* Re: [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe()
  2019-02-15 21:20 [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Alexey Khoroshilov
  2019-02-16  8:17 ` Sergei Shtylyov
@ 2019-02-17 23:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-02-17 23:44 UTC (permalink / raw)
  To: khoroshilov; +Cc: sebastian.hesselbarth, netdev, linux-kernel, ldv-project

From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 16 Feb 2019 00:20:54 +0300

> If mv643xx_eth_shared_of_probe() fails, mv643xx_eth_shared_probe()
> leaves clk undisabled.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Applied with undisabled changed to enabled.

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

end of thread, other threads:[~2019-02-17 23:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-15 21:20 [PATCH] net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe() Alexey Khoroshilov
2019-02-16  8:17 ` Sergei Shtylyov
2019-02-17 23:44 ` 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).