drm/tegra: sor: Disable clocks on error in tegra_sor_init()
authorQinglang Miao <miaoqinglang@huawei.com>
Fri, 30 Oct 2020 01:34:24 +0000 (09:34 +0800)
committerThierry Reding <treding@nvidia.com>
Thu, 26 Nov 2020 17:44:48 +0000 (18:44 +0100)
Fix the missing clk_disable_unprepare() before return from
tegra_sor_init() in the error handling case.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/sor.c

index 00656d8..cc2aa23 100644 (file)
@@ -3143,6 +3143,7 @@ static int tegra_sor_init(struct host1x_client *client)
                if (err < 0) {
                        dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
                                err);
+                       clk_disable_unprepare(sor->clk);
                        return err;
                }
 
@@ -3150,12 +3151,17 @@ static int tegra_sor_init(struct host1x_client *client)
        }
 
        err = clk_prepare_enable(sor->clk_safe);
-       if (err < 0)
+       if (err < 0) {
+               clk_disable_unprepare(sor->clk);
                return err;
+       }
 
        err = clk_prepare_enable(sor->clk_dp);
-       if (err < 0)
+       if (err < 0) {
+               clk_disable_unprepare(sor->clk_safe);
+               clk_disable_unprepare(sor->clk);
                return err;
+       }
 
        return 0;
 }