Re: [PATCH v3 03/10] software node: allow referencing firmware nodes

Andy Shevchenko
2025-10-31T09:46:54Z

On Fri, Oct 31, 2025 at 10:00:37AM +0100, Bartosz Golaszewski wrote:
> On Fri, Oct 31, 2025 at 9:24 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Thu, Oct 30, 2025 at 04:17:48AM -0700, Bartosz Golaszewski wrote:

...

> > But first of all, your series doesn't compile AFAICS:
> >
> > drivers/reset/core.c:981:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
> > 981 | if (IS_ERR(rgpio_dev->swnode))
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/reset/core.c:1001:9: note: uninitialized use occurs here
> > 1001 | return ret;
> > | ^~~
> > drivers/reset/core.c:981:2: note: remove the 'if' if its condition is always false
> > 981 | if (IS_ERR(rgpio_dev->swnode))
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 982 | goto err_put_of_node;
> > | ~~~~~~~~~~~~~~~~~~~~
> > drivers/reset/core.c:905:13: note: initialize the variable 'ret' to silence this warning
> > 905 | int id, ret, lflags;
> > | ^
> > | = 0
> > 1 error generated.
>
> You're not wrong but for the record: it builds fine for me with
> aarch64-linux-gnu-gcc 14.2 for some reason so I didn't notice it. I'll
> fix it.

GCC is not _the_ compiler nowadays. And building with `make W=1` should be a good
practice for subsystem maintainers :-)

...

> > So, but to the topic
> >
> > I have applied this and get the only error as per above
> >
> > (const struct software_node_ref_args) { \
> > - ._node = _ref, \
> > + .swnode = _Generic(_ref, const struct software_node *: _ref, default: NULL), \
> > + .fwnode = _Generic(_ref, struct fwnode_handle *: _ref, default: NULL), \
> >
>
> That works, thanks for the idea.

You're welcome!

--
With Best Regards,
Andy Shevchenko