Skip to content

Commit

Permalink
ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
plbossart committed Mar 31, 2023
1 parent b34993b commit 93747c5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions sound/soc/sof/sof-client-probes.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,

ret = ipc->points_info(cdev, &desc, &num_desc);
if (ret < 0)
goto exit;

pm_runtime_mark_last_busy(dev);
err = pm_runtime_put_autosuspend(dev);
if (err < 0)
dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);
goto pm_error;

for (i = 0; i < num_desc; i++) {
offset = strlen(buf);
Expand All @@ -241,6 +236,13 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf));

kfree(desc);

pm_error:
pm_runtime_mark_last_busy(dev);
err = pm_runtime_put_autosuspend(dev);
if (err < 0)
dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);

exit:
kfree(buf);
return ret;
Expand Down

0 comments on commit 93747c5

Please sign in to comment.