mirror of https://gitee.com/openkylin/linux.git
drm/tegra: sor: Do not leak runtime PM reference
It's theoretically possible for the runtime PM reference to leak if the code fails anywhere between the pm_runtime_resume_and_get() and pm_runtime_put() calls, so make sure to release the runtime PM reference in that case. Practically this will never happen because none of the functions will fail on Tegra, but it's better for the code to be pedantic in case these assumptions will ever become wrong. Signed-off-by: Pavel Machek (CIP) <pavel@denx.de> [treding@nvidia.com: add commit message] Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
6efb943b86
commit
73a395c467
|
@ -3125,21 +3125,21 @@ static int tegra_sor_init(struct host1x_client *client)
|
|||
if (err < 0) {
|
||||
dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
|
||||
err);
|
||||
return err;
|
||||
goto rpm_put;
|
||||
}
|
||||
|
||||
err = reset_control_assert(sor->rst);
|
||||
if (err < 0) {
|
||||
dev_err(sor->dev, "failed to assert SOR reset: %d\n",
|
||||
err);
|
||||
return err;
|
||||
goto rpm_put;
|
||||
}
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(sor->clk);
|
||||
if (err < 0) {
|
||||
dev_err(sor->dev, "failed to enable clock: %d\n", err);
|
||||
return err;
|
||||
goto rpm_put;
|
||||
}
|
||||
|
||||
usleep_range(1000, 3000);
|
||||
|
@ -3150,7 +3150,7 @@ static int tegra_sor_init(struct host1x_client *client)
|
|||
dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
|
||||
err);
|
||||
clk_disable_unprepare(sor->clk);
|
||||
return err;
|
||||
goto rpm_put;
|
||||
}
|
||||
|
||||
reset_control_release(sor->rst);
|
||||
|
@ -3171,6 +3171,12 @@ static int tegra_sor_init(struct host1x_client *client)
|
|||
}
|
||||
|
||||
return 0;
|
||||
|
||||
rpm_put:
|
||||
if (sor->rst)
|
||||
pm_runtime_put(sor->dev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int tegra_sor_exit(struct host1x_client *client)
|
||||
|
|
Loading…
Reference in New Issue