2022-04-25 12:32:03

by CGEL

[permalink] [raw]
Subject: [PATCH] drm/msm/dpu: fix error check return value of irq_of_parse_and_map()

From: Lv Ruyi <[email protected]>

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 <[email protected]>
Signed-off-by: Lv Ruyi <[email protected]>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

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;

--
2.25.1


2022-04-25 23:36:31

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] drm/msm/dpu: fix error check return value of irq_of_parse_and_map()

Quoting [email protected] (2022-04-25 02:09:47)
> From: Lv Ruyi <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Lv Ruyi <[email protected]>
> ---

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

Reviewed-by: Stephen Boyd <[email protected]>

2022-04-26 00:48:40

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH] drm/msm/dpu: fix error check return value of irq_of_parse_and_map()

On 25/04/2022 23:10, Stephen Boyd wrote:
> Quoting [email protected] (2022-04-25 02:09:47)
>> From: Lv Ruyi <[email protected]>
>>
>> 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 <[email protected]>
>> Signed-off-by: Lv Ruyi <[email protected]>
>> ---
>
> 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 <[email protected]>


--
With best wishes
Dmitry