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 580BFC54FA7 for ; Wed, 28 Aug 2024 12:49:12 +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=2o3Ew/GkZbzSNq2qTTVPLbruJnCErWR5cn6xjrthpaM=; b=yfQsGwuj5SB/Pr4Z16/nLySNcA fQ3THBUINtjKOrL2mV2WMdyq8AmogGetA2arqhaeWteSQ3yZw35GRb/CHg/E47kYBlL0yHkUHQ6Qv w3WBQwvslErsy5AyR4AGZSyH+b42jmi6wEKAAOEfweD2zn0XI2Za4OoNFudkDhH+5tbwCurrz1yz3 8zSay3lkwLzr8+f0RTZsEtpG8dvWMmC3uSK0aqDhUIAiLd49ZlISSS8K0Mi8nM8/hMiI+46SPZ7DH VfU8NWunDciaxxHBP0l3syu2RAMPpxX6+qHFfYARiPgiXZ5fF5aV/QjcwrWIxxpnOv6HgqlSuO6Oc j+limM1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjI6d-0000000FNvm-3I3K; Wed, 28 Aug 2024 12:48:59 +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 1sjI2M-0000000FN94-2SXM for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 12:44:36 +0000 Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Wv3tb0pftz6H7Wp; Wed, 28 Aug 2024 20:41:11 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 54F3E140447; Wed, 28 Aug 2024 20:44:27 +0800 (CST) Received: from localhost (10.203.177.66) 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; Wed, 28 Aug 2024 13:44:26 +0100 Date: Wed, 28 Aug 2024 13:44:25 +0100 From: Jonathan Cameron To: Jinjie Ruan CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH net-next v2 06/13] net: phy: Use for_each_available_child_of_node_scoped() Message-ID: <20240828134425.000042c7@Huawei.com> In-Reply-To: <20240828032343.1218749-7-ruanjinjie@huawei.com> References: <20240828032343.1218749-1-ruanjinjie@huawei.com> <20240828032343.1218749-7-ruanjinjie@huawei.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.177.66] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) 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-20240828_054434_793614_4C45AB40 X-CRM114-Status: GOOD ( 13.50 ) 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 Wed, 28 Aug 2024 11:23:36 +0800 Jinjie Ruan wrote: > Avoid need to manually handle of_node_put() by using > for_each_available_child_of_node_scoped(), which can simplfy code. > > Signed-off-by: Jinjie Ruan Ah. I see Andrew mentioned he didn't like the __free change hence you've only done this one. Fair enough I guess. Reviewed-by: Jonathan Cameron > --- > - Split into 2 patches. > --- > drivers/net/phy/phy_device.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index 243dae686992..560e338b307a 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -3407,7 +3407,7 @@ static int of_phy_led(struct phy_device *phydev, > static int of_phy_leds(struct phy_device *phydev) > { > struct device_node *node = phydev->mdio.dev.of_node; > - struct device_node *leds, *led; > + struct device_node *leds; > int err; > > if (!IS_ENABLED(CONFIG_OF_MDIO)) > @@ -3420,10 +3420,9 @@ static int of_phy_leds(struct phy_device *phydev) > if (!leds) > return 0; > > - for_each_available_child_of_node(leds, led) { > + for_each_available_child_of_node_scoped(leds, led) { > err = of_phy_led(phydev, led); > if (err) { > - of_node_put(led); > of_node_put(leds); > phy_leds_unregister(phydev); > return err;