On 11/06/2024 16:01, Markus Elfring wrote: > … >> Add the missing calls to fwnode_handle_put(child) to avoid memory leaks >> in the error paths. > > I suggest to apply a goto chain for a while. > https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources > > Will the application of scope-based resource management become feasible with another delay? > https://elixir.bootlin.com/linux/v6.10-rc3/source/include/linux/cleanup.h#L8 > > Regards, > Markus I considered that option too, but there is still no _scoped() variant of the loop. The scoped version of the _available_ variant is being discussed, though. Maybe that one could be used here if there is no need to iterate over unavailable nodes. We could not back port that solution anyway, so I would suggest this solution (or the one with a goto), and then a separate patch to used a scoped macro if preferred. Best regards, Javier Carrasco