Skip to content

Commit c5c0383

Browse files
jhovoldbroonie
authored andcommitted
ASoC: codecs: wcd938x-sdw: fix runtime PM imbalance on probe errors
Make sure to balance the runtime PM operations, including the disable count, on probe errors and on driver unbind. Fixes: 1657252 ("ASoC: codecs: wcd938x-sdw: add SoundWire driver") Cc: [email protected] # 5.14 Cc: Srinivas Kandagatla <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f0dfdcb commit c5c0383

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sound/soc/codecs/wcd938x-sdw.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,18 @@ static int wcd9380_probe(struct sdw_slave *pdev,
12781278
pm_runtime_set_active(dev);
12791279
pm_runtime_enable(dev);
12801280

1281-
return component_add(dev, &wcd938x_sdw_component_ops);
1281+
ret = component_add(dev, &wcd938x_sdw_component_ops);
1282+
if (ret)
1283+
goto err_disable_rpm;
1284+
1285+
return 0;
1286+
1287+
err_disable_rpm:
1288+
pm_runtime_disable(dev);
1289+
pm_runtime_set_suspended(dev);
1290+
pm_runtime_dont_use_autosuspend(dev);
1291+
1292+
return ret;
12821293
}
12831294

12841295
static int wcd9380_remove(struct sdw_slave *pdev)
@@ -1287,6 +1298,10 @@ static int wcd9380_remove(struct sdw_slave *pdev)
12871298

12881299
component_del(dev, &wcd938x_sdw_component_ops);
12891300

1301+
pm_runtime_disable(dev);
1302+
pm_runtime_set_suspended(dev);
1303+
pm_runtime_dont_use_autosuspend(dev);
1304+
12901305
return 0;
12911306
}
12921307

0 commit comments

Comments
 (0)