[-next] media: platform: ti: fix the return value handle for platform_get_irq()

Message ID 20230731120212.2017996-1-ruanjinjie@huawei.com (mailing list archive)
State Accepted
Delegated to: Sakari Ailus
Headers
Series [-next] media: platform: ti: fix the return value handle for platform_get_irq() |

Commit Message

Jinjie Ruan July 31, 2023, 12:02 p.m. UTC
  There is no possible for platform_get_irq() to return 0,
and the return value of platform_get_irq() is more sensible
to show the error reason.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 +---
 drivers/media/platform/ti/omap3isp/isp.c       | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
  

Comments

Laurent Pinchart Aug. 2, 2023, 9:04 p.m. UTC | #1
Hi Ruan,

Thank you for the patch.

On Mon, Jul 31, 2023 at 08:02:12PM +0800, Ruan Jinjie wrote:
> There is no possible for platform_get_irq() to return 0,
> and the return value of platform_get_irq() is more sensible
> to show the error reason.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 +---
>  drivers/media/platform/ti/omap3isp/isp.c       | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> index 81a63a3865cf..a85b97107de7 100644
> --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> @@ -2420,10 +2420,8 @@ static int vpfe_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = platform_get_irq(pdev, 0);
> -	if (ret <= 0) {
> -		ret = -ENODEV;
> +	if (ret < 0)
>  		goto probe_out_cleanup;
> -	}
>  	vpfe->irq = ret;
>  
>  	ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
> diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
> index f3aaa9e76492..226db75221cd 100644
> --- a/drivers/media/platform/ti/omap3isp/isp.c
> +++ b/drivers/media/platform/ti/omap3isp/isp.c
> @@ -2398,10 +2398,8 @@ static int isp_probe(struct platform_device *pdev)
>  
>  	/* Interrupt */
>  	ret = platform_get_irq(pdev, 0);
> -	if (ret <= 0) {
> -		ret = -ENODEV;
> +	if (ret < 0)
>  		goto error_iommu;
> -	}
>  	isp->irq_num = ret;
>  
>  	if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,

The changes look fine to me.

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

Sakari, would you like to merge this through your tree ?
  
Sakari Ailus Aug. 3, 2023, 10:20 a.m. UTC | #2
On Thu, Aug 03, 2023 at 12:04:44AM +0300, Laurent Pinchart wrote:
> Hi Ruan,
> 
> Thank you for the patch.
> 
> On Mon, Jul 31, 2023 at 08:02:12PM +0800, Ruan Jinjie wrote:
> > There is no possible for platform_get_irq() to return 0,
> > and the return value of platform_get_irq() is more sensible
> > to show the error reason.
> > 
> > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> > ---
> >  drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 +---
> >  drivers/media/platform/ti/omap3isp/isp.c       | 4 +---
> >  2 files changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> > index 81a63a3865cf..a85b97107de7 100644
> > --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> > +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> > @@ -2420,10 +2420,8 @@ static int vpfe_probe(struct platform_device *pdev)
> >  	}
> >  
> >  	ret = platform_get_irq(pdev, 0);
> > -	if (ret <= 0) {
> > -		ret = -ENODEV;
> > +	if (ret < 0)
> >  		goto probe_out_cleanup;
> > -	}
> >  	vpfe->irq = ret;
> >  
> >  	ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
> > diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
> > index f3aaa9e76492..226db75221cd 100644
> > --- a/drivers/media/platform/ti/omap3isp/isp.c
> > +++ b/drivers/media/platform/ti/omap3isp/isp.c
> > @@ -2398,10 +2398,8 @@ static int isp_probe(struct platform_device *pdev)
> >  
> >  	/* Interrupt */
> >  	ret = platform_get_irq(pdev, 0);
> > -	if (ret <= 0) {
> > -		ret = -ENODEV;
> > +	if (ret < 0)
> >  		goto error_iommu;
> > -	}
> >  	isp->irq_num = ret;
> >  
> >  	if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
> 
> The changes look fine to me.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Sakari, would you like to merge this through your tree ?

Done, thanks. I'll push it this afternoon to my git.linuxtv.org tree.
  
Prabhakar Aug. 3, 2023, 1:40 p.m. UTC | #3
On Mon, Jul 31, 2023 at 1:02 PM Ruan Jinjie <ruanjinjie@huawei.com> wrote:
>
> There is no possible for platform_get_irq() to return 0,
> and the return value of platform_get_irq() is more sensible
> to show the error reason.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 +---
>  drivers/media/platform/ti/omap3isp/isp.c       | 4 +---
>  2 files changed, 2 insertions(+), 6 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com>

Cheers,
Prabhakar

> diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> index 81a63a3865cf..a85b97107de7 100644
> --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
> @@ -2420,10 +2420,8 @@ static int vpfe_probe(struct platform_device *pdev)
>         }
>
>         ret = platform_get_irq(pdev, 0);
> -       if (ret <= 0) {
> -               ret = -ENODEV;
> +       if (ret < 0)
>                 goto probe_out_cleanup;
> -       }
>         vpfe->irq = ret;
>
>         ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
> diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
> index f3aaa9e76492..226db75221cd 100644
> --- a/drivers/media/platform/ti/omap3isp/isp.c
> +++ b/drivers/media/platform/ti/omap3isp/isp.c
> @@ -2398,10 +2398,8 @@ static int isp_probe(struct platform_device *pdev)
>
>         /* Interrupt */
>         ret = platform_get_irq(pdev, 0);
> -       if (ret <= 0) {
> -               ret = -ENODEV;
> +       if (ret < 0)
>                 goto error_iommu;
> -       }
>         isp->irq_num = ret;
>
>         if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
> --
> 2.34.1
>
  

Patch

diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index 81a63a3865cf..a85b97107de7 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -2420,10 +2420,8 @@  static int vpfe_probe(struct platform_device *pdev)
 	}
 
 	ret = platform_get_irq(pdev, 0);
-	if (ret <= 0) {
-		ret = -ENODEV;
+	if (ret < 0)
 		goto probe_out_cleanup;
-	}
 	vpfe->irq = ret;
 
 	ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c
index f3aaa9e76492..226db75221cd 100644
--- a/drivers/media/platform/ti/omap3isp/isp.c
+++ b/drivers/media/platform/ti/omap3isp/isp.c
@@ -2398,10 +2398,8 @@  static int isp_probe(struct platform_device *pdev)
 
 	/* Interrupt */
 	ret = platform_get_irq(pdev, 0);
-	if (ret <= 0) {
-		ret = -ENODEV;
+	if (ret < 0)
 		goto error_iommu;
-	}
 	isp->irq_num = ret;
 
 	if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,