drm/stm: ltdc: Fix leak of px clk enable in some error paths
authorPhilippe CORNU <philippe.cornu@st.com>
Mon, 17 Jul 2017 07:40:17 +0000 (09:40 +0200)
committerArchit Taneja <architt@codeaurora.org>
Tue, 18 Jul 2017 06:36:41 +0000 (12:06 +0530)
The pixel clock gets enabled early during init, since it's required
in order to read registers. This pixel clock must be disabled if
errors during this init phase.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1500277223-29553-2-git-send-email-philippe.cornu@st.com
drivers/gpu/drm/stm/ltdc.c

index 533176015cbbe2e1a731b73f464d3898c5867476..7f64d5aeb080f75297b7cb3e42435a568157677a 100644 (file)
@@ -1045,13 +1045,15 @@ int ltdc_load(struct drm_device *ddev)
 
        if (of_address_to_resource(np, 0, &res)) {
                DRM_ERROR("Unable to get resource\n");
-               return -ENODEV;
+               ret = -ENODEV;
+               goto err;
        }
 
        ldev->regs = devm_ioremap_resource(dev, &res);
        if (IS_ERR(ldev->regs)) {
                DRM_ERROR("Unable to get ltdc registers\n");
-               return PTR_ERR(ldev->regs);
+               ret = PTR_ERR(ldev->regs);
+               goto err;
        }
 
        for (i = 0; i < MAX_IRQ; i++) {
@@ -1064,7 +1066,7 @@ int ltdc_load(struct drm_device *ddev)
                                                dev_name(dev), ddev);
                if (ret) {
                        DRM_ERROR("Failed to register LTDC interrupt\n");
-                       return ret;
+                       goto err;
                }
        }
 
@@ -1079,7 +1081,7 @@ int ltdc_load(struct drm_device *ddev)
        if (ret) {
                DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
                          ldev->caps.hw_version);
-               return ret;
+               goto err;
        }
 
        DRM_INFO("ltdc hw version 0x%08x - ready\n", ldev->caps.hw_version);