Skip to content

Commit 64c7d7e

Browse files
committed
PM: runtime: clk: Fix clk_pm_runtime_get() error path
clk_pm_runtime_get() assumes that the PM-runtime usage counter will be dropped by pm_runtime_get_sync() on errors, which is not the case, so PM-runtime references to devices acquired by the former are leaked on errors returned by the latter. Fix this by modifying clk_pm_runtime_get() to drop the reference if pm_runtime_get_sync() returns an error. Fixes: 9a34b45 clk: Add support for runtime PM Cc: 4.15+ <[email protected]> # 4.15+ Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Ulf Hansson <[email protected]>
1 parent 3618bba commit 64c7d7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/clk/clk.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ static int clk_pm_runtime_get(struct clk_core *core)
114114
return 0;
115115

116116
ret = pm_runtime_get_sync(core->dev);
117-
return ret < 0 ? ret : 0;
117+
if (ret < 0) {
118+
pm_runtime_put_noidle(core->dev);
119+
return ret;
120+
}
121+
return 0;
118122
}
119123

120124
static void clk_pm_runtime_put(struct clk_core *core)

0 commit comments

Comments
 (0)