Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling

When an error occurs, we need to make sure the device can pm_runtime
suspend instead of keeping it active.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Link: https://lore.kernel.org/r/20230512103315.8921-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org

authored by

Pierre-Louis Bossart and committed by
Mark Brown
bc424273 da0fe8fd

+8 -6
+8 -6
sound/soc/sof/sof-client-probes.c
··· 218 218 219 219 ret = ipc->points_info(cdev, &desc, &num_desc); 220 220 if (ret < 0) 221 - goto exit; 222 - 223 - pm_runtime_mark_last_busy(dev); 224 - err = pm_runtime_put_autosuspend(dev); 225 - if (err < 0) 226 - dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err); 221 + goto pm_error; 227 222 228 223 for (i = 0; i < num_desc; i++) { 229 224 offset = strlen(buf); ··· 236 241 ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf)); 237 242 238 243 kfree(desc); 244 + 245 + pm_error: 246 + pm_runtime_mark_last_busy(dev); 247 + err = pm_runtime_put_autosuspend(dev); 248 + if (err < 0) 249 + dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err); 250 + 239 251 exit: 240 252 kfree(buf); 241 253 return ret;