Skip to contentSkip to conversation

drm/msm/dsi: Fix return value check for clk_get_parent

PATCH New Sean Paul 1 participant 1 message Aug 7, 2019

Subsystems (4)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

PATCH 1/1 drm/msm/dsi: Fix return value check for clk_get_parent

From: Sean Paul <[email protected]>

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 <[email protected]>
Cc Sean Paul <[email protected]>
Cc Rob Clark <[email protected]>
Cc <[email protected]> # v4.19+
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +4 -4
index aa35d18ab43c9..02acb4338721a 100644
@@ -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;
 	}
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno