diff mbox series

[v2] drm: msm: fix error check return value of irq_of_parse_and_map()

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

Commit Message

CGEL April 24, 2022, 3:19 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 an negative value.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
v2: don't print irq, and return ERR_PTR(-EINVAL)
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Dmitry Baryshkov April 25, 2022, 10:23 p.m. UTC | #1
On 24/04/2022 06:19, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> The irq_of_parse_and_map() function returns 0 on failure, and does not
> return an negative value.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
> v2: don't print irq, and return ERR_PTR(-EINVAL)
> ---
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index 3b92372e7bdf..44e395e59df9 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -570,9 +570,9 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
>   	}
>   
>   	irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
> -	if (irq < 0) {
> -		ret = irq;
> -		DRM_DEV_ERROR(&pdev->dev, "failed to get irq: %d\n", ret);
> +	if (!irq) {
> +		ret = -EINVAL;
> +		DRM_DEV_ERROR(&pdev->dev, "failed to get irq\n");
>   		goto fail;
>   	}
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 3b92372e7bdf..44e395e59df9 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -570,9 +570,9 @@  struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 	}
 
 	irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
-	if (irq < 0) {
-		ret = irq;
-		DRM_DEV_ERROR(&pdev->dev, "failed to get irq: %d\n", ret);
+	if (!irq) {
+		ret = -EINVAL;
+		DRM_DEV_ERROR(&pdev->dev, "failed to get irq\n");
 		goto fail;
 	}