public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: <linus.walleij@linaro.org>, <dan.carpenter@linaro.org>,
	<linux-gpio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <aisheng.dong@nxp.com>,
	<festevam@gmail.com>, <shawnguo@kernel.org>,
	<kernel@pengutronix.de>, <u.kleine-koenig@pengutronix.de>,
	Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH V3 2/3] pinctrl: equilibrium: Use scope based of_node_put() cleanups
Date: Mon, 1 Jul 2024 13:56:51 +0100	[thread overview]
Message-ID: <20240701135651.0000768a@Huawei.com> (raw)
In-Reply-To: <20240627131721.678727-3-peng.fan@oss.nxp.com>

On Thu, 27 Jun 2024 21:17:20 +0800
"Peng Fan (OSS)" <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
> 
> Use scope based of_node_put() cleanup to simplify code.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/pinctrl/pinctrl-equilibrium.c | 21 +++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c
> index a6d089eaaae5..3a9a0f059090 100644
> --- a/drivers/pinctrl/pinctrl-equilibrium.c
> +++ b/drivers/pinctrl/pinctrl-equilibrium.c
> @@ -588,7 +588,6 @@ static int funcs_utils(struct device *dev, struct pinfunction *funcs,
>  		       unsigned int *nr_funcs, funcs_util_ops op)
>  {
>  	struct device_node *node = dev->of_node;
> -	struct device_node *np;
>  	struct property *prop;
>  	const char *fn_name;
>  	const char **groups;
> @@ -596,7 +595,7 @@ static int funcs_utils(struct device *dev, struct pinfunction *funcs,
>  	int i, j;
>  
>  	i = 0;
> -	for_each_child_of_node(node, np) {
> +	for_each_child_of_node_scoped(node, np) {
>  		prop = of_find_property(np, "groups", NULL);
>  		if (!prop)
>  			continue;
> @@ -635,7 +634,6 @@ static int funcs_utils(struct device *dev, struct pinfunction *funcs,
>  			break;
>  
>  		default:
> -			of_node_put(np);
>  			return -EINVAL;
>  		}
>  		i++;
> @@ -708,11 +706,10 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
>  	struct device_node *node = dev->of_node;
>  	unsigned int *pins, *pinmux, pin_id, pinmux_id;
>  	struct pingroup group, *grp = &group;
> -	struct device_node *np;
>  	struct property *prop;
>  	int j, err;
>  
> -	for_each_child_of_node(node, np) {
> +	for_each_child_of_node_scoped(node, np) {
>  		prop = of_find_property(np, "groups", NULL);
>  		if (!prop)
>  			continue;
> @@ -720,42 +717,35 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata)
>  		err = of_property_count_u32_elems(np, "pins");
>  		if (err < 0) {
>  			dev_err(dev, "No pins in the group: %s\n", prop->name);
> -			of_node_put(np);
Given I think this is only called from probe, return dev_err_probe() works
nicely here as well.

>  			return err;
>  		}
Either way,
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

  reply	other threads:[~2024-07-01 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 13:17 [PATCH V3 0/3] pinctrl: use scope based of_node_put Peng Fan (OSS)
2024-06-27 13:17 ` [PATCH V3 1/3] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Peng Fan (OSS)
2024-06-28 10:51   ` Uwe Kleine-König
2024-06-29  1:32     ` Peng Fan
2024-06-29  8:08       ` Uwe Kleine-König
2024-07-01 12:54   ` Jonathan Cameron
2024-06-27 13:17 ` [PATCH V3 2/3] pinctrl: equilibrium: " Peng Fan (OSS)
2024-07-01 12:56   ` Jonathan Cameron [this message]
2024-06-27 13:17 ` [PATCH V3 3/3] pinctrl: freescale: " Peng Fan (OSS)
2024-07-01 12:59   ` Jonathan Cameron
2024-07-03 12:42 ` [PATCH V3 0/3] pinctrl: use scope based of_node_put Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240701135651.0000768a@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=aisheng.dong@nxp.com \
    --cc=dan.carpenter@linaro.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox