Re: [PATCHv2 3/6] hwmon: (socfpga) Add hardware monitoring support on SoCFPGA platforms

From: Andy Shevchenko
Date: Fri May 12 2023 - 07:11:58 EST


On Tue, May 09, 2023 at 08:57:26AM +0200, Krzysztof Kozlowski wrote:
> On 08/05/2023 23:28, dinh.nguyen@xxxxxxxxxxxxxxx wrote:

...

> > + struct device_node *child;
> > + int ret = 0;
> > +
> > + for_each_child_of_node(np, child) {
> > + ret = socfpga_probe_child_from_dt(dev, child, priv);
> > + if (ret)
> > + break;
> > + }
> > + of_node_put(child);
>
> Hm, and if the loop does not break, is this still correct?

Yes, since NULL is okay for of_node_put(). However the explicit call inside the
if (ret) can be more obvious on what's going on.

> > + return ret;

--
With Best Regards,
Andy Shevchenko