public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] media: bcm2835-unicam: Improve error handling during probe
@ 2024-05-06 19:24 Ricardo Ribalda
  2024-05-06 19:24 ` [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode " Ricardo Ribalda
  2024-05-06 19:24 ` [PATCH v2 2/2] media: bcm2835-unicam: Do not print error when irq not found Ricardo Ribalda
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2024-05-06 19:24 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda, Laurent Pinchart

Improve the error handling of the irq errors. I am not sure why the
retcode was replaced always with -EINVAL, so I have returned the errcode
upwards.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v2: Thanks Laurent
- Squash 3/3 in 1/3
- Link to v1: https://lore.kernel.org/r/20240430-fix-broad-v1-0-cf3b81bf97ff@chromium.org

---
Ricardo Ribalda (2):
      media: bcm2835-unicam: Do not replace IRQ retcode during probe
      media: bcm2835-unicam: Do not print error when irq not found

 drivers/media/platform/broadcom/bcm2835-unicam.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
base-commit: 1c73d0b29d04bf4082e7beb6a508895e118ee30d
change-id: 20240430-fix-broad-490eb1a39754

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode during probe
  2024-05-06 19:24 [PATCH v2 0/2] media: bcm2835-unicam: Improve error handling during probe Ricardo Ribalda
@ 2024-05-06 19:24 ` Ricardo Ribalda
  2024-05-07  6:08   ` Laurent Pinchart
  2024-05-06 19:24 ` [PATCH v2 2/2] media: bcm2835-unicam: Do not print error when irq not found Ricardo Ribalda
  1 sibling, 1 reply; 4+ messages in thread
From: Ricardo Ribalda @ 2024-05-06 19:24 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda

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(-)

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;
 	}
 

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] media: bcm2835-unicam: Do not print error when irq not found
  2024-05-06 19:24 [PATCH v2 0/2] media: bcm2835-unicam: Improve error handling during probe Ricardo Ribalda
  2024-05-06 19:24 ` [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode " Ricardo Ribalda
@ 2024-05-06 19:24 ` Ricardo Ribalda
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2024-05-06 19:24 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda, Laurent Pinchart

platform_get_irq() already prints an error for us.

Fix this cocci warning:
drivers/media/platform/broadcom/bcm2835-unicam.c:2664:2-9: line 2664 is redundant because platform_get_irq() already prints an error

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 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 60c0fe956c58..0b2729bf4a36 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -2660,10 +2660,8 @@ static int unicam_probe(struct platform_device *pdev)
 	}
 
 	ret = platform_get_irq(pdev, 0);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "No IRQ resource\n");
+	if (ret < 0)
 		goto err_unicam_put;
-	}
 
 	ret = devm_request_irq(&pdev->dev, ret, unicam_isr, 0,
 			       "unicam_capture0", unicam);

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode during probe
  2024-05-06 19:24 ` [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode " Ricardo Ribalda
@ 2024-05-07  6:08   ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2024-05-07  6:08 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil

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;
>  	}
>  

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-07  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 19:24 [PATCH v2 0/2] media: bcm2835-unicam: Improve error handling during probe Ricardo Ribalda
2024-05-06 19:24 ` [PATCH v2 1/2] media: bcm2835-unicam: Do not replace IRQ retcode " Ricardo Ribalda
2024-05-07  6:08   ` Laurent Pinchart
2024-05-06 19:24 ` [PATCH v2 2/2] media: bcm2835-unicam: Do not print error when irq not found Ricardo Ribalda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox