mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 21:54:11 +08:00
drm/tegra: Fix reference leak when pm_runtime_get_sync() fails
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>
This commit is contained in:
parent
3ef170c25b
commit
dcdfe2712b
@ -2186,7 +2186,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;
|
||||
|
@ -1111,7 +1111,7 @@ static int tegra_dsi_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;
|
||||
|
@ -1510,7 +1510,7 @@ static int tegra_hdmi_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;
|
||||
|
@ -789,7 +789,7 @@ static int tegra_display_hub_runtime_resume(struct host1x_client *client)
|
||||
unsigned int i;
|
||||
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;
|
||||
|
@ -3218,7 +3218,7 @@ static int tegra_sor_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;
|
||||
|
@ -331,7 +331,7 @@ static int vic_open_channel(struct tegra_drm_client *client,
|
||||
struct vic *vic = to_vic(client);
|
||||
int err;
|
||||
|
||||
err = pm_runtime_get_sync(vic->dev);
|
||||
err = pm_runtime_resume_and_get(vic->dev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user