Commit ad2139cb authored by Thierry Reding's avatar Thierry Reding

drm/tegra: sor: Disable runtime PM on probe failure

If the driver fails to probe, make sure to disable runtime PM again.

While at it, make the cleanup code in ->remove() symmetric.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent a5127a2d
...@@ -3925,13 +3925,13 @@ static int tegra_sor_probe(struct platform_device *pdev) ...@@ -3925,13 +3925,13 @@ static int tegra_sor_probe(struct platform_device *pdev)
sor->index); sor->index);
if (!name) { if (!name) {
err = -ENOMEM; err = -ENOMEM;
goto remove; goto rpm_disable;
} }
err = host1x_client_resume(&sor->client); err = host1x_client_resume(&sor->client);
if (err < 0) { if (err < 0) {
dev_err(sor->dev, "failed to resume: %d\n", err); dev_err(sor->dev, "failed to resume: %d\n", err);
goto remove; goto rpm_disable;
} }
sor->clk_pad = tegra_clk_sor_pad_register(sor, name); sor->clk_pad = tegra_clk_sor_pad_register(sor, name);
...@@ -3942,7 +3942,7 @@ static int tegra_sor_probe(struct platform_device *pdev) ...@@ -3942,7 +3942,7 @@ static int tegra_sor_probe(struct platform_device *pdev)
err = PTR_ERR(sor->clk_pad); err = PTR_ERR(sor->clk_pad);
dev_err(&pdev->dev, "failed to register SOR pad clock: %d\n", dev_err(&pdev->dev, "failed to register SOR pad clock: %d\n",
err); err);
goto remove; goto rpm_disable;
} }
INIT_LIST_HEAD(&sor->client.list); INIT_LIST_HEAD(&sor->client.list);
...@@ -3953,11 +3953,13 @@ static int tegra_sor_probe(struct platform_device *pdev) ...@@ -3953,11 +3953,13 @@ static int tegra_sor_probe(struct platform_device *pdev)
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "failed to register host1x client: %d\n", dev_err(&pdev->dev, "failed to register host1x client: %d\n",
err); err);
goto remove; goto rpm_disable;
} }
return 0; return 0;
rpm_disable:
pm_runtime_disable(&pdev->dev);
remove: remove:
if (sor->ops && sor->ops->remove) if (sor->ops && sor->ops->remove)
sor->ops->remove(sor); sor->ops->remove(sor);
...@@ -3971,8 +3973,6 @@ static int tegra_sor_remove(struct platform_device *pdev) ...@@ -3971,8 +3973,6 @@ static int tegra_sor_remove(struct platform_device *pdev)
struct tegra_sor *sor = platform_get_drvdata(pdev); struct tegra_sor *sor = platform_get_drvdata(pdev);
int err; int err;
pm_runtime_disable(&pdev->dev);
err = host1x_client_unregister(&sor->client); err = host1x_client_unregister(&sor->client);
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "failed to unregister host1x client: %d\n", dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
...@@ -3980,6 +3980,8 @@ static int tegra_sor_remove(struct platform_device *pdev) ...@@ -3980,6 +3980,8 @@ static int tegra_sor_remove(struct platform_device *pdev)
return err; return err;
} }
pm_runtime_disable(&pdev->dev);
if (sor->ops && sor->ops->remove) { if (sor->ops && sor->ops->remove) {
err = sor->ops->remove(sor); err = sor->ops->remove(sor);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment