diff mbox series

drm/msm/dpu: fix error check return value of irq_of_parse_and_map()

Message ID 20220425090947.3498897-1-lv.ruyi@zte.com.cn (mailing list archive)
State Not Applicable
Headers show
Series drm/msm/dpu: fix error check return value of irq_of_parse_and_map() | expand

Commit Message

CGEL April 25, 2022, 9:09 a.m. UTC
From: Lv Ruyi <lv.ruyi@zte.com.cn>

The irq_of_parse_and_map() function returns 0 on failure, and does not
return a negative value anyhow, so never enter this conditional branch.

Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stephen Boyd April 25, 2022, 8:10 p.m. UTC | #1
Quoting cgel.zte@gmail.com (2022-04-25 02:09:47)
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> The irq_of_parse_and_map() function returns 0 on failure, and does not
> return a negative value anyhow, so never enter this conditional branch.
>
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---

Question still stands why we can't use platform device APIs.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Dmitry Baryshkov April 25, 2022, 9:08 p.m. UTC | #2
On 25/04/2022 23:10, Stephen Boyd wrote:
> Quoting cgel.zte@gmail.com (2022-04-25 02:09:47)
>> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>>
>> The irq_of_parse_and_map() function returns 0 on failure, and does not
>> return a negative value anyhow, so never enter this conditional branch.
>>
>> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
>> Reported-by: Zeal Robot <zealci@zte.com.cn>
>> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
>> ---
> 
> Question still stands why we can't use platform device APIs.

Let's do a separate pass and replace all of functions with platform 
device API.

> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index e29796c4f27b..36eeeae7fe45 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1187,9 +1187,9 @@  struct msm_kms *dpu_kms_init(struct drm_device *dev)
 	dpu_kms = to_dpu_kms(priv->kms);
 
 	irq = irq_of_parse_and_map(dpu_kms->pdev->dev.of_node, 0);
-	if (irq < 0) {
-		DPU_ERROR("failed to get irq: %d\n", irq);
-		return ERR_PTR(irq);
+	if (!irq) {
+		DPU_ERROR("failed to get irq\n");
+		return ERR_PTR(-EINVAL);
 	}
 	dpu_kms->base.irq = irq;