Skip to content

Commit

Permalink
media: rcar-vin: Fix a reference count leak.
Browse files Browse the repository at this point in the history
[ Upstream commit aaffa01 ]

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus call pm_runtime_put_noidle()
if pm_runtime_get_sync() fails.

Fixes: 90dedce ("media: rcar-vin: add function to manipulate Gen3 chsel value")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
QiushiWu authored and gregkh committed Oct 29, 2020
1 parent a6ca853 commit 5e32b7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/platform/rcar-vin/rcar-dma.c
Expand Up @@ -1409,8 +1409,10 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel)
int ret;

ret = pm_runtime_get_sync(vin->dev);
if (ret < 0)
if (ret < 0) {
pm_runtime_put_noidle(vin->dev);
return ret;
}

/* Make register writes take effect immediately. */
vnmc = rvin_read(vin, VNMC_REG);
Expand Down

0 comments on commit 5e32b7f

Please sign in to comment.