On Mon, Dec 20, 2021 at 8:08 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote: > On Mon, Dec 20, 2021 at 3:19 PM Daniel Lezcano > <daniel.lezcano@xxxxxxxxxx> wrote: > > On 20/12/2021 14:48, Geert Uytterhoeven wrote: > > > On Mon, Dec 20, 2021 at 1:29 PM Daniel Lezcano > > > <daniel.lezcano@xxxxxxxxxx> 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