[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zs0FFtUKI7sZBl4r@nixie71>
Date: Mon, 26 Aug 2024 17:43:34 -0500
From: Jeff LaBundy <jeff@...undy.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: linux-input@...r.kernel.org,
Michael Hennerich <michael.hennerich@...log.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Thierry Reding <thierry.reding@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
Tony Lindgren <tony@...mide.com>, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH 08/17] Input: iqs62x-keys - use cleanup facility for
fwnodes
Hi Dmitry,
On Sat, Aug 24, 2024 at 10:16:12PM -0700, Dmitry Torokhov wrote:
> Use __free(fwnode_handle) cleanup facility to ensure that references
> to acquired fwnodes are dropped at appropriate times automatically.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
Reviewed-by: Jeff LaBundy <jeff@...undy.com>
> ---
> drivers/input/keyboard/iqs62x-keys.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/keyboard/iqs62x-keys.c b/drivers/input/keyboard/iqs62x-keys.c
> index 688d61244b5f..1315b0f0862f 100644
> --- a/drivers/input/keyboard/iqs62x-keys.c
> +++ b/drivers/input/keyboard/iqs62x-keys.c
> @@ -45,7 +45,6 @@ struct iqs62x_keys_private {
> static int iqs62x_keys_parse_prop(struct platform_device *pdev,
> struct iqs62x_keys_private *iqs62x_keys)
> {
> - struct fwnode_handle *child;
> unsigned int val;
> int ret, i;
>
> @@ -68,7 +67,8 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
> }
>
> for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) {
> - child = device_get_named_child_node(&pdev->dev,
> + struct fwnode_handle *child __free(fwnode_handle) =
> + device_get_named_child_node(&pdev->dev,
> iqs62x_switch_names[i]);
> if (!child)
> continue;
> @@ -77,7 +77,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
> if (ret) {
> dev_err(&pdev->dev, "Failed to read switch code: %d\n",
> ret);
> - fwnode_handle_put(child);
> return ret;
> }
> iqs62x_keys->switches[i].code = val;
> @@ -91,8 +90,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev,
> iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ?
> IQS62X_EVENT_HALL_N_T :
> IQS62X_EVENT_HALL_S_T);
> -
> - fwnode_handle_put(child);
> }
>
> return 0;
> --
> 2.46.0.295.g3b9ea8a38a-goog
>
Kind regards,
Jeff LaBundy
Powered by blists - more mailing lists