Re: [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup

From: Andy Shevchenko

Date: Sun Oct 04 2026 - 04:20:26 EST


On Sun, Oct 04, 2026 at 08:08:18AM +0700, Bui Duc Phuc wrote:

...

> Thank you for pointing me to the discussion.

> > Have you read the discussion [1]?
> > It would be better to make platform_get_irq_optional() to be actually optional.
> >
> > [1]: https://lore.kernel.org/lkml/20220212201631.12648-1-s.shtylyov@xxxxxx/
>
> However, Regardless of how the API might be redesigned in the future
> to return 0
> or negative error codes, the fundamental requirement at the driver
> level remains
> the same: real errors must be propagated properly.
>
> This patch isn't concerned with the API style discussion, but rather
> with ensuring
> that driver probe doesn't silently swallow genuine errors like ⁠-EPROBE_DEFER⁠.
> Proper error reporting is necessary under any reasonable API design.

Yes, but doing specific error handling is usually not a good idea as it adds
ambiguity. Like -EINVAL was used to check if the device property is present or
not at the time of trying to parse it. This was specifically clarified in the
documentation [2]. This is just an example of why the checking over a certain
error code is not good.

[2]: 70fa0c308aa2 ("device property: Document how to check for the property presence")

--
With Best Regards,
Andy Shevchenko