drm/tegra: Fix reference leak when pm_runtime_get_sync() fails
[ Upstream commit dcdfe2712b68f1e9dbf4f1a96ad59b80e5cc0ef7 ]
The PM reference count is not expected to be incremented on return in
these Tegra functions.
However, pm_runtime_get_sync() will increment the PM reference count
even on failure. Forgetting to put the reference again will result in
a leak.
Replace it with pm_runtime_resume_and_get() to keep the usage counter
balanced.
Fixes: fd67e9c6ed
("drm/tegra: Do not implement runtime PM")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
cc1c1fe795
commit
0cdfdd1f03
@@ -2184,7 +2184,7 @@ static int tegra_dc_runtime_resume(struct host1x_client *client)
|
||||
struct device *dev = client->dev;
|
||||
int err;
|
||||
|
||||
err = pm_runtime_get_sync(dev);
|
||||
err = pm_runtime_resume_and_get(dev);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "failed to get runtime PM: %d\n", err);
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user