Skip to content

Commit

Permalink
spi: img-spfi: fix reference leak in img_spfi_resume
Browse files Browse the repository at this point in the history
[ Upstream commit ee5558a ]

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in img_spfi_resume, so we should fix it.

Fixes: deba258 ("spi: Add driver for IMG SPFI controller")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201102145651.3875-1-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhang Qilong authored and gregkh committed Dec 30, 2020
1 parent 130a887 commit 5eab98b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/spi/spi-img-spfi.c
Expand Up @@ -731,8 +731,10 @@ static int img_spfi_resume(struct device *dev)
int ret;

ret = pm_runtime_get_sync(dev);
if (ret)
if (ret) {
pm_runtime_put_noidle(dev);
return ret;
}
spfi_reset(spfi);
pm_runtime_put(dev);

Expand Down

0 comments on commit 5eab98b

Please sign in to comment.