drm/msm/dsi: Fix return value check for clk_get_parent
authorSean Paul <seanpaul@chromium.org>
Wed, 7 Aug 2019 18:51:50 +0000 (14:51 -0400)
committerRob Clark <robdclark@chromium.org>
Tue, 3 Sep 2019 23:17:02 +0000 (16:17 -0700)
clk_get_parent returns an error pointer upon failure, not NULL. So the
checks as they exist won't catch a failure. This patch changes the
checks and the return values to properly handle an error pointer.

Fixes: c4d8cfe516dc ("drm/msm/dsi: add implementation for helper functions")
Cc: Sibi Sankar <sibis@codeaurora.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Rob Clark <robdclark@chromium.org>
Cc: <stable@vger.kernel.org> # v4.19+
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/dsi/dsi_host.c

index e65c2b8bf5557e70fb640b928a379f7809d705c7..663ff9f4fac973811bcaa930a574eb27e3c71de0 100644 (file)
@@ -421,15 +421,15 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
        }
 
        msm_host->byte_clk_src = clk_get_parent(msm_host->byte_clk);
-       if (!msm_host->byte_clk_src) {
-               ret = -ENODEV;
+       if (IS_ERR(msm_host->byte_clk_src)) {
+               ret = PTR_ERR(msm_host->byte_clk_src);
                pr_err("%s: can't find byte_clk clock. ret=%d\n", __func__, ret);
                goto exit;
        }
 
        msm_host->pixel_clk_src = clk_get_parent(msm_host->pixel_clk);
-       if (!msm_host->pixel_clk_src) {
-               ret = -ENODEV;
+       if (IS_ERR(msm_host->pixel_clk_src)) {
+               ret = PTR_ERR(msm_host->pixel_clk_src);
                pr_err("%s: can't find pixel_clk clock. ret=%d\n", __func__, ret);
                goto exit;
        }