diff mbox series

[v2,1/2] media: bcm2835-unicam: Do not replace IRQ retcode during probe

Message ID 20240506-fix-broad-v2-1-e6a2a5c0d609@chromium.org (mailing list archive)
State New, archived
Headers show
Series media: bcm2835-unicam: Improve error handling during probe | expand

Commit Message

Ricardo Ribalda May 6, 2024, 7:24 p.m. UTC
platform_get_irq() cannot return the value 0. It will either return a non-zero
irq or a errcode.

If a errcode is returned, we need to populate the error code upwards. It will
give a more accurate reason of why it failed to the caller, who might decide
to retry later.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/broadcom/bcm2835-unicam.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Laurent Pinchart May 7, 2024, 6:08 a.m. UTC | #1
Hi Ricardo,

Thank you for the patch.

On Mon, May 06, 2024 at 07:24:46PM +0000, Ricardo Ribalda wrote:
> platform_get_irq() cannot return the value 0. It will either return a non-zero
> irq or a errcode.
> 
> If a errcode is returned, we need to populate the error code upwards. It will
> give a more accurate reason of why it failed to the caller, who might decide
> to retry later.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Aren't git commit messages supposed to be wrapped at 72 columns ?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/broadcom/bcm2835-unicam.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
> index bd2bbb53070e..60c0fe956c58 100644
> --- a/drivers/media/platform/broadcom/bcm2835-unicam.c
> +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
> @@ -2660,9 +2660,8 @@ static int unicam_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = platform_get_irq(pdev, 0);
> -	if (ret <= 0) {
> +	if (ret < 0) {
>  		dev_err(&pdev->dev, "No IRQ resource\n");
> -		ret = -EINVAL;
>  		goto err_unicam_put;
>  	}
>  
> @@ -2670,7 +2669,6 @@ static int unicam_probe(struct platform_device *pdev)
>  			       "unicam_capture0", unicam);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Unable to request interrupt\n");
> -		ret = -EINVAL;
>  		goto err_unicam_put;
>  	}
>
diff mbox series

Patch

diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index bd2bbb53070e..60c0fe956c58 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -2660,9 +2660,8 @@  static int unicam_probe(struct platform_device *pdev)
 	}
 
 	ret = platform_get_irq(pdev, 0);
-	if (ret <= 0) {
+	if (ret < 0) {
 		dev_err(&pdev->dev, "No IRQ resource\n");
-		ret = -EINVAL;
 		goto err_unicam_put;
 	}
 
@@ -2670,7 +2669,6 @@  static int unicam_probe(struct platform_device *pdev)
 			       "unicam_capture0", unicam);
 	if (ret) {
 		dev_err(&pdev->dev, "Unable to request interrupt\n");
-		ret = -EINVAL;
 		goto err_unicam_put;
 	}