Skip to contentSkip to conversation

mfd: arizona: Use pm_runtime_resume_and_get() to prevent refcnt leak

PATCH Applied Liang He 3 participants 3 messages Jan 5, 2023 – Jan 20, 2023

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH v2 1/1 mfd: arizona: Use pm_runtime_resume_and_get() to prevent refcnt leak

In arizona_clk32k_enable(), we should use pm_runtime_resume_and_get() as pm_runtime_get_sync() will increase the refcnt even when it returns an error.

---
changelog:
v1: add missing pm_runtime_put_sync()
v2: use pm_runtime_resume_and_get()

 drivers/mfd/arizona-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/arizona-core.c +1 -1
index cbf1dd90b70d..b1c53e040771 100644
@@ -45,7 +45,7 @@ int arizona_clk32k_enable(struct arizona *arizona)
 	if (arizona->clk32k_ref == 1) {
 		switch (arizona->pdata.clk32k_src) {
 		case ARIZONA_32KZ_MCLK1:
-			ret = pm_runtime_get_sync(arizona->dev);
+			ret = pm_runtime_resume_and_get(arizona->dev);
 			if (ret != 0)
 				goto err_ref;
 			ret = clk_prepare_enable(arizona->mclk[ARIZONA_MCLK1]);
Signature · 1 line
2.25.1
maintainer Applied
#2 lore raw
In reply to Liang He
Quoted 4 lines · Liang He

In arizona_clk32k_enable(), we should use pm_runtime_resume_and_get() as pm_runtime_get_sync() will increase the refcnt even when it returns an error.

Quoted 8 lines

---
changelog:
v1: add missing pm_runtime_put_sync()
v2: use pm_runtime_resume_and_get()

 drivers/mfd/arizona-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Signature · 1 line
Lee Jones [李琼斯]