wlcore: mesh: handle failure case of pm_runtime_get_sync
diff mbox series

Message ID 20200605032733.49846-1-navid.emamdoost@gmail.com
State Rejected
Delegated to: Kalle Valo
Headers show
Series
  • wlcore: mesh: handle failure case of pm_runtime_get_sync
Related show

Commit Message

Navid Emamdoost June 5, 2020, 3:27 a.m. UTC
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count. Call pm_runtime_put if
pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/ti/wlcore/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tony Lindgren June 5, 2020, 4:49 p.m. UTC | #1
* Navid Emamdoost <navid.emamdoost@gmail.com> [200605 03:28]:
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.

Looks like we have a similar patch already in Linux next,
care to check?

Regards,

Tony
Kalle Valo July 15, 2020, 8:35 a.m. UTC | #2
Navid Emamdoost <navid.emamdoost@gmail.com> wrote:

> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

Already fixed by another patch.

Patch set to Rejected.

Patch
diff mbox series

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index f140f7d7f553..c7e4f5a80b9e 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -3662,8 +3662,10 @@  void wlcore_regdomain_config(struct wl1271 *wl)
 		goto out;
 
 	ret = pm_runtime_get_sync(wl->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_autosuspend(wl->dev);
 		goto out;
+	}
 
 	ret = wlcore_cmd_regdomain_config_locked(wl);
 	if (ret < 0) {