All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: fix missing unlock on error in stmmac_suspend()
@ 2021-03-16  7:42 ` 'w00385741
  0 siblings, 0 replies; 4+ messages in thread
From: 'w00385741 @ 2021-03-16  7:42 UTC (permalink / raw)
  To: weiyongjun1, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Jakub Kicinski, Maxime Coquelin, Philipp Zabel, Russell King,
	Joakim Zhang
  Cc: netdev, linux-stm32, linux-arm-kernel, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

Add the missing unlock before return from function
stmmac_suspend() in the error handling case.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a10704d8e3c6..d50df998d3aa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5400,8 +5400,10 @@ int stmmac_suspend(struct device *dev)
 		/* Disable clock in case of PWM is off */
 		clk_disable_unprepare(priv->plat->clk_ptp_ref);
 		ret = pm_runtime_force_suspend(dev);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&priv->lock);
 			return ret;
+		}
 	}
 	mutex_unlock(&priv->lock);
 


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

* [PATCH net-next] net: stmmac: fix missing unlock on error in stmmac_suspend()
@ 2021-03-16  7:42 ` 'w00385741
  0 siblings, 0 replies; 4+ messages in thread
From: 'w00385741 @ 2021-03-16  7:42 UTC (permalink / raw)
  To: weiyongjun1, Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Jakub Kicinski, Maxime Coquelin, Philipp Zabel, Russell King,
	Joakim Zhang
  Cc: netdev, linux-stm32, linux-arm-kernel, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.com>

Add the missing unlock before return from function
stmmac_suspend() in the error handling case.

Fixes: 5ec55823438e ("net: stmmac: add clocks management for gmac driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a10704d8e3c6..d50df998d3aa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5400,8 +5400,10 @@ int stmmac_suspend(struct device *dev)
 		/* Disable clock in case of PWM is off */
 		clk_disable_unprepare(priv->plat->clk_ptp_ref);
 		ret = pm_runtime_force_suspend(dev);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&priv->lock);
 			return ret;
+		}
 	}
 	mutex_unlock(&priv->lock);
 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH net-next] net: stmmac: fix missing unlock on error in stmmac_suspend()
       [not found] ` <CAOc6etYcE-0wbcWxgTH49h1Odepg=Esc_gmfDoUioHOsnNj33Q@mail.gmail.com>
@ 2021-03-16 13:55     ` Edmundo Carmona Antoranz
  0 siblings, 0 replies; 4+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-16 13:55 UTC (permalink / raw)
  To: 'w00385741
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Jakub Kicinski,
	Maxime Coquelin, Philipp Zabel, Russell King, Joakim Zhang,
	netdev, linux-stm32, linux-arm-kernel, kernel-janitors,
	Hulk Robot

On Tue, Mar 16, 2021 at 7:50 AM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:

> I think you can let it go and check ret after unlocking:
>
>                 /* Disable clock in case of PWM is off */
>                clk_disable_unprepare(priv->plat->clk_ptp_ref);
>                ret = pm_runtime_force_suspend(dev);
>        }
>        mutex_unlock(&priv->lock);
>        if (ret)
>                return ret;

Oh, I C. It would require ret to be set to 0 before starting to use
it, right? Maybe it's worth it?

>
>        priv->speed = SPEED_UNKNOWN;
>        return 0;
>

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

* Re: [PATCH net-next] net: stmmac: fix missing unlock on error in stmmac_suspend()
@ 2021-03-16 13:55     ` Edmundo Carmona Antoranz
  0 siblings, 0 replies; 4+ messages in thread
From: Edmundo Carmona Antoranz @ 2021-03-16 13:55 UTC (permalink / raw)
  To: 'w00385741
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Jakub Kicinski,
	Maxime Coquelin, Philipp Zabel, Russell King, Joakim Zhang,
	netdev, linux-stm32, linux-arm-kernel, kernel-janitors,
	Hulk Robot

On Tue, Mar 16, 2021 at 7:50 AM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:

> I think you can let it go and check ret after unlocking:
>
>                 /* Disable clock in case of PWM is off */
>                clk_disable_unprepare(priv->plat->clk_ptp_ref);
>                ret = pm_runtime_force_suspend(dev);
>        }
>        mutex_unlock(&priv->lock);
>        if (ret)
>                return ret;

Oh, I C. It would require ret to be set to 0 before starting to use
it, right? Maybe it's worth it?

>
>        priv->speed = SPEED_UNKNOWN;
>        return 0;
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-03-16 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  7:42 [PATCH net-next] net: stmmac: fix missing unlock on error in stmmac_suspend() 'w00385741
2021-03-16  7:42 ` 'w00385741
     [not found] ` <CAOc6etYcE-0wbcWxgTH49h1Odepg=Esc_gmfDoUioHOsnNj33Q@mail.gmail.com>
2021-03-16 13:55   ` Edmundo Carmona Antoranz
2021-03-16 13:55     ` Edmundo Carmona Antoranz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.