netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wlcore: mesh: handle failure case of pm_runtime_get_sync
@ 2020-06-05  3:27 Navid Emamdoost
  2020-06-05 16:49 ` Tony Lindgren
  2020-07-15  8:35 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Navid Emamdoost @ 2020-06-05  3:27 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Johannes Berg, Thomas Gleixner,
	Greg Kroah-Hartman, Hari Nagalla, Jason A. Donenfeld,
	Emmanuel Grumbach, Maital Hahn, Fuqian Huang, Tony Lindgren,
	Navid Emamdoost, linux-wireless, netdev, linux-kernel
  Cc: emamd001, wu000273, kjlu, smccaman

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(-)

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) {
-- 
2.17.1


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

end of thread, other threads:[~2020-07-15  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-05  3:27 [PATCH] wlcore: mesh: handle failure case of pm_runtime_get_sync Navid Emamdoost
2020-06-05 16:49 ` Tony Lindgren
2020-07-15  8:35 ` Kalle Valo

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).