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

ASoC: img-parallel-out: Fix a reference count leak

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code, causing incorrect ref count if
pm_runtime_put_noidle() is not called in error handling paths.
Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.

Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Link: https://lore.kernel.org/r/20200614033344.1814-1-wu000273@umn.edu
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Qiushi Wu and committed by
Mark Brown
6b9fbb07 c4c59b95

+3 -1
+3 -1
sound/soc/img/img-parallel-out.c
··· 163 163 } 164 164 165 165 ret = pm_runtime_get_sync(prl->dev); 166 - if (ret < 0) 166 + if (ret < 0) { 167 + pm_runtime_put_noidle(prl->dev); 167 168 return ret; 169 + } 168 170 169 171 reg = img_prl_out_readl(prl, IMG_PRL_OUT_CTL); 170 172 reg = (reg & ~IMG_PRL_OUT_CTL_EDGE_MASK) | control_set;