Re: [PATCH v2] thermal: rcar_thermal: Use platform_get_irq_optional() to get the interrupt

From: Andy Shevchenko
Date: Sat Dec 25 2021 - 10:56:06 EST


On Sat, Dec 25, 2021 at 1:41 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Friday, December 24, 2021, Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> wrote:

...

>> + int irq;
>> +
>> + irq = platform_get_irq_optional(pdev, i);
>> + if (irq == -ENXIO)
>> + break;
>> + if (irq < 0) {
>> + ret = irq;
>> + goto error_unregister;
>> + }
>
>
> In all your patches which introduce optional IRQ please change the logic to the opposite:
>
> if (irq > 0)
> ...we got one...
> if (irq == -EPROBE_DEFER)
> ...return it, if it is ever possible...
>
> With this you adding me a work.

I noticed that in some patches you actually do the right things, so,
please do it in the same way where you use _optiomal() variant, i.e.

if (ret < 0 && ret != -ENXIO)
return ret;
if (ret > 0)
...we got it...

--
With Best Regards,
Andy Shevchenko