]> git.baikalelectronics.ru Git - kernel.git/commit
media: rcar_fdp1: fix pm_runtime_get_sync() usage count
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 23 Apr 2021 14:59:34 +0000 (16:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:38 +0000 (11:35 +0200)
commitc3433771abb2a82646de373e80b52e31f5fe486f
treeefdcde036629e83d8f6c88d950651076a471f3a8
parenta20195c78c85080514a46b198054378093c78b96
media: rcar_fdp1: fix pm_runtime_get_sync() usage count

[ Upstream commit 0929cdebc2e044f8f654a5c07f5c8fd96ceec033 ]

The pm_runtime_get_sync() internally increments the
dev->power.usage_count without decrementing it, even on errors.
Replace it by the new pm_runtime_resume_and_get(), introduced by:
commit c4a28fe77ffc ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
in order to properly decrement the usage counter, avoiding
a potential PM usage counter leak.

Also, right now, the driver is ignoring any troubles when
trying to do PM resume. So, add the proper error handling
for the code.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Stable-dep-of: c766c90faf93 ("media: rcar_fdp1: Fix refcount leak in probe and remove function")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/rcar_fdp1.c