From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FB5FC2BD09 for ; Mon, 1 Jul 2024 12:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O7YAMfcbi5AnhMVlXI0cBYL6OinrNvDZJY7t1IKs7TU=; b=soO4m7QMlP6+zj2STcnhu/Em4a Q9Q6w+2ntdGKWPxfP20akPC2EyURzwqB0d9JYYgq5tb48S6sk9le/+Qcy/2yskoU2iWm5ZfNXnYsR W/7GOjCdm+ptWTAURba4daZXWab09vAjOt6LeI+m3Kea2Hi51zGjwgcX9WP669RXN6x+36Fi9ul+J xXin8UVsg9doNh1UH0W2I4chx+4NvajOWIds6KmrHs5n4njJeLW8+iRaNGIMlAQ0QXKSQeEnmCpjW LoBLi+rO1d6ZQmUlH5mWJ9kUFyYXnqs6lDAewegck4OvG5Mw9hZjG6eSebVydGgTU1wCcAKks3oXu lkEVh9fA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOGam-00000003MXu-3wh2; Mon, 01 Jul 2024 12:57:12 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOGaZ-00000003MSP-2NQt for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2024 12:57:02 +0000 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WCQyN1y87z6K5vp; Mon, 1 Jul 2024 20:55:56 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 9B624140B33; Mon, 1 Jul 2024 20:56:53 +0800 (CST) Received: from localhost (10.203.174.77) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 1 Jul 2024 13:56:53 +0100 Date: Mon, 1 Jul 2024 13:56:51 +0100 From: Jonathan Cameron To: "Peng Fan (OSS)" CC: , , , , , , , , , , Peng Fan Subject: Re: [PATCH V3 2/3] pinctrl: equilibrium: Use scope based of_node_put() cleanups Message-ID: <20240701135651.0000768a@Huawei.com> In-Reply-To: <20240627131721.678727-3-peng.fan@oss.nxp.com> References: <20240627131721.678727-1-peng.fan@oss.nxp.com> <20240627131721.678727-3-peng.fan@oss.nxp.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.174.77] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_055700_154290_9C35C6F4 X-CRM114-Status: GOOD ( 14.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 27 Jun 2024 21:17:20 +0800 "Peng Fan (OSS)" wrote: > From: Peng Fan > > Use scope based of_node_put() cleanup to simplify code. > > Signed-off-by: Peng Fan > --- > 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