[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0IuidPSjPIla9Z9@surfacebook.localdomain>
Date: Sat, 23 Nov 2024 21:35:37 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Gene Chen <gene_chen@...htek.com>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Bartosz Golaszewski <brgl@...ev.pl>, Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH 07/18] leds: gpio: switch to
device_for_each_child_node_scoped()
Fri, Sep 27, 2024 at 01:20:58AM +0200, Javier Carrasco kirjoitti:
> Switch to device_for_each_child_node_scoped() to simplify the code by
> removing the need for calls to fwnode_handle_put() in the error paths.
>
> This also prevents possible memory leaks if new error paths are added
> without the required call to fwnode_handle_put().
...
> if (IS_ERR(led.gpiod)) {
> dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n",
> child);
> - fwnode_handle_put(child);
> return ERR_CAST(led.gpiod);
Here you may use dev_err_ptr_probe()
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists