lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 25 Dec 2021 19:53:04 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Daniel Lezcano <daniel.lezcano@...aro.org>,
        Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        Niklas Söderlund <niklas.soderlund@...natech.se>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux PM list <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Prabhakar <prabhakar.csengg@...il.com>
Subject: Re: [PATCH] thermal: rcar_thermal: Use platform_get_irq_optional() to
 get the interrupt

On Mon, Dec 20, 2021 at 8:08 PM Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> On Mon, Dec 20, 2021 at 3:19 PM Daniel Lezcano
> <daniel.lezcano@...aro.org> wrote:
> > On 20/12/2021 14:48, Geert Uytterhoeven wrote:
> > > On Mon, Dec 20, 2021 at 1:29 PM Daniel Lezcano
> > > <daniel.lezcano@...aro.org> wrote:
> > >> On 18/12/2021 15:41, Lad Prabhakar wrote:


> > >>> +             irq = platform_get_irq_optional(pdev, i);
> > >>> +             if (irq <= 0 && irq != -ENXIO) {
> > >>> +                     ret = irq ? irq : -ENXIO;
> > >>> +                     goto error_unregister;
> > >>> +             }
> > >>> +             if (irq == -ENXIO)
> > >>>                       continue;
> > >>
> > >> Why not invert the conditions?
> > >>
> > >>                 if (irq == -ENXIO)
> > >>                         continue;
> > >
> > > And this can be break.
> > >
> > >>
> > >>                 if (irq <= 0) {
> > >>                         ret = irq ? irq : -ENXIO;
> > >
> > > irq == 0 cannot happen.

Even if it's so, it adds a burden on my shoulders in the future.

> > >>                         goto out_unregister;
> > >>                 }

> I think so, as I don't see your point, neither ;-)
>
> I meant (a) there is no need to continue the loop when there are no
> more interrupts present, and (b) irq == 0 cannot happen, so the cod
> can be simplified to:
>
>     if (irq == -ENXIO)
>             break;

This should be a better check to include 0 as no IRQ case. It will
allow the platform_get_irq_optional() API to be aligned with other
_optional() APIs.

>     if (irq < 0) {
>             ret = irq;
>             goto out_unregister;
>     }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ