Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup

Bui Duc Phuc <[email protected]>
Newsgroups org.kernel.vger.linux-pm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-renesas-soc
Message-ID <CAABR9nF7sAT4C+W_qE8GVKhrtTjdm=DcpJH548RzFaYLuED+3A@mail.gmail.com>
Hi Geert,

Thank you for your feedback.

> >                 irq = platform_get_irq_optional(pdev, i);
> > -               if (irq < 0)
> > +               if (irq < 0 && irq != -ENXIO)
> >                         return irq;
> >
>
> So the code may continue using -ENXIO as an interrupt number (and fail)?
>

Yes, you are right. We should probably handle it similarly to:
https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_thermal.c#L422
and only assign the IRQ when the return value is positive:
if (ret > 0)
   irq = ret;

> Why is this change needed at all?
> The caller of rcar_gen3_thermal_request_irqs() knows how to handle
> failures, as IRQs are optional.
>

Regarding the caller, I only found rcar_gen3_thermal_request_irqs()
being called here:
https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_gen3_thermal.c#L530
It does not appear to handle the error return there, so I don't think
the caller currently handles these failures explicitly.

Best regards,
Phuc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.