Re: [PATCH linux-next] media: i2c: st-mipid02: replace of_node_put() with __free

From: Sakari Ailus
Date: Mon Apr 29 2024 - 05:05:25 EST


Hi Benjamin,

On Mon, Apr 29, 2024 at 10:52:34AM +0200, Benjamin Mugnier wrote:
> Hi,
>
> Thank you for your patch.
>
> On 4/27/24 11:56, R Sundar wrote:
> > Use the new cleanup magic to replace of_node_put() with
> > __free(device_node) marking to auto release and to simplify the error
> > paths.
> >
> > Suggested-by: Julia Lawall <julia.lawall@xxxxxxxx>
> > Signed-off-by: R Sundar <prosunofficial@xxxxxxxxx>
>
> I was not aware of this kind of auto release mechanism. Thanks for
> bringing that to my eyes.
>
> Now I looked in /drivers/media and couldn't find such structure. All
> drivers seem to follow the goto error_of_node_put style.
> As I'm unsure if we want to introduce such magic, could either Laurent
> or Sakari comment on this ?

It's new and little used so far. I don't have concerns using it, although
it's mostly useful in cases where all exit paths release the same resource.

--
Kind regards,

Sakari Ailus