Skip to contentSkip to conversation

mfd: arizona: handle pm_runtime_get_sync failure case

PATCH In review Navid Emamdoost 2 participants 2 messages Jun 5, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: arizona: handle pm_runtime_get_sync failure case

Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put_sync if pm_runtime_get_sync fails.

---
 drivers/mfd/arizona-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/arizona-core.c +3 -1
index f73cf76d1373..5b3191b6534a 100644
@@ -46,8 +46,10 @@ int arizona_clk32k_enable(struct arizona *arizona)
 		switch (arizona->pdata.clk32k_src) {
 		case ARIZONA_32KZ_MCLK1:
 			ret = pm_runtime_get_sync(arizona->dev);
-			if (ret != 0)
+			if (ret != 0) {
+				pm_runtime_put_sync(arizona->dev);
 				goto err_ref;
+			}
 			ret = clk_prepare_enable(arizona->mclk[ARIZONA_MCLK1]);
 			if (ret != 0) {
 				pm_runtime_put_sync(arizona->dev);
Signature · 1 line
2.17.1