linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: rcar_fdp1: Fix the correct variable assignments
@ 2021-10-21  3:09 Tang Bin
  2021-10-21  7:59 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2021-10-21  3:09 UTC (permalink / raw)
  To: kieran.bingham+renesas, mchehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tang Bin

In the function fdp1_probe(), when get irq failed, the
function platform_get_irq() log an error message, so
remove redundant message here. And the variable type
of "ret" is int, the "fdp1->irq" is unsigned int, when
irq failed, this place maybe wrong, thus fix it.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/media/platform/rcar_fdp1.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
index 89aac6006..d79bf1461 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -2289,11 +2289,10 @@ static int fdp1_probe(struct platform_device *pdev)
 		return PTR_ERR(fdp1->regs);
 
 	/* Interrupt service routine registration */
-	fdp1->irq = ret = platform_get_irq(pdev, 0);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "cannot find IRQ\n");
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
 		return ret;
-	}
+	fdp1->irq = ret;
 
 	ret = devm_request_irq(&pdev->dev, fdp1->irq, fdp1_irq_handler, 0,
 			       dev_name(&pdev->dev), fdp1);
-- 
2.20.1.windows.1




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

* Re: [PATCH] media: rcar_fdp1: Fix the correct variable assignments
  2021-10-21  3:09 [PATCH] media: rcar_fdp1: Fix the correct variable assignments Tang Bin
@ 2021-10-21  7:59 ` Geert Uytterhoeven
  2021-10-21  9:08   ` Kieran Bingham
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-10-21  7:59 UTC (permalink / raw)
  To: Tang Bin
  Cc: Kieran Bingham, Mauro Carvalho Chehab, Linux Media Mailing List,
	Linux-Renesas, Linux Kernel Mailing List

Hi Tang,

Thanks for your patch!

On Thu, Oct 21, 2021 at 5:10 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
> In the function fdp1_probe(), when get irq failed, the
> function platform_get_irq() log an error message, so
> remove redundant message here. And the variable type
> of "ret" is int, the "fdp1->irq" is unsigned int, when
> irq failed, this place maybe wrong, thus fix it.

The second issue is not actually present, as the error check
operates on ret, not fdp1->irq?

> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

> --- a/drivers/media/platform/rcar_fdp1.c
> +++ b/drivers/media/platform/rcar_fdp1.c
> @@ -2289,11 +2289,10 @@ static int fdp1_probe(struct platform_device *pdev)
>                 return PTR_ERR(fdp1->regs);
>
>         /* Interrupt service routine registration */
> -       fdp1->irq = ret = platform_get_irq(pdev, 0);
> -       if (ret < 0) {
> -               dev_err(&pdev->dev, "cannot find IRQ\n");
> +       ret = platform_get_irq(pdev, 0);
> +       if (ret < 0)
>                 return ret;
> -       }
> +       fdp1->irq = ret;
>
>         ret = devm_request_irq(&pdev->dev, fdp1->irq, fdp1_irq_handler, 0,
>                                dev_name(&pdev->dev), fdp1);

Anyway, the code is correct, so:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] media: rcar_fdp1: Fix the correct variable assignments
  2021-10-21  7:59 ` Geert Uytterhoeven
@ 2021-10-21  9:08   ` Kieran Bingham
  0 siblings, 0 replies; 3+ messages in thread
From: Kieran Bingham @ 2021-10-21  9:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Tang Bin
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List, Linux-Renesas,
	Linux Kernel Mailing List

Hi Tang,

Quoting Geert Uytterhoeven (2021-10-21 08:59:18)
> Hi Tang,
> 
> Thanks for your patch!
> 
> On Thu, Oct 21, 2021 at 5:10 AM Tang Bin <tangbin@cmss.chinamobile.com> wrote:
> > In the function fdp1_probe(), when get irq failed, the
> > function platform_get_irq() log an error message, so
> > remove redundant message here. And the variable type
> > of "ret" is int, the "fdp1->irq" is unsigned int, when
> > irq failed, this place maybe wrong, thus fix it.
> 
> The second issue is not actually present, as the error check
> operates on ret, not fdp1->irq?

Agreed, the error print is redundant. 

In fact it would have erroneously print on ret=-EPROBE_DEFER cases too,
so it's not just redundant, but inaccurate too.

I don't think the assignment of fdp1->irq = ret at the same time is an
issue, because if ret < 0, fdp1->irq wouldn't ever get read, as the call
returns.

But .. I have no objection to setting it after instead.

> > Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> 
> > --- a/drivers/media/platform/rcar_fdp1.c
> > +++ b/drivers/media/platform/rcar_fdp1.c
> > @@ -2289,11 +2289,10 @@ static int fdp1_probe(struct platform_device *pdev)
> >                 return PTR_ERR(fdp1->regs);
> >
> >         /* Interrupt service routine registration */
> > -       fdp1->irq = ret = platform_get_irq(pdev, 0);
> > -       if (ret < 0) {
> > -               dev_err(&pdev->dev, "cannot find IRQ\n");
> > +       ret = platform_get_irq(pdev, 0);
> > +       if (ret < 0)
> >                 return ret;
> > -       }
> > +       fdp1->irq = ret;
> >
> >         ret = devm_request_irq(&pdev->dev, fdp1->irq, fdp1_irq_handler, 0,
> >                                dev_name(&pdev->dev), fdp1);
> 
> Anyway, the code is correct, so:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Perhaps with the commit message updated/simplified, but either way:

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

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

end of thread, other threads:[~2021-10-21  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  3:09 [PATCH] media: rcar_fdp1: Fix the correct variable assignments Tang Bin
2021-10-21  7:59 ` Geert Uytterhoeven
2021-10-21  9:08   ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).