From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F84E288C22 for ; Tue, 6 Jan 2026 04:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767674710; cv=none; b=TQtxwJDun8vreXDWe3UyxUvqui73ULlQ34Of3gu+EGj7IxRsuo1qXiZT5CgYEXDxaqBEsUfHmsp0AUB6xrGdZplSJg4Ro9h6taEgGBvdt0N2xDoFfg4/8PA6yaB+vlouvX8Odo0D2iE3dEmPSUwtKV6TF4nwL8Y4NlGrI7HJ2nA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767674710; c=relaxed/simple; bh=NZlhb0e+LTm3bKA95odK6xrvpduyxVe3bxnYDOQQBHw=; h=Message-ID:Date:MIME-Version:Subject:To:References:Cc:From: In-Reply-To:Content-Type; b=cCmXLOXxVFjqgVg1ArlJeuf6glTmKLtjb0zv2co3betrOtgcVUmCvcI/s2JW/3NFOGAuJJ8TPhy0NFE78bC+TmJgoXt19l4LVZWJPP91AvZsBrTATqjy+hg3tUFCYnOFzq4iZ1peo0rZX3Iinj32nxmD7if0/6zH42e/7ygZPgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO iyokan3-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 06 Jan 2026 13:45:07 +0900 Received: from mail.mfilter.local (mail-arc01.css.socionext.com [10.213.46.36]) by iyokan3-ex.css.socionext.com (Postfix) with ESMTP id 2AC422091484; Tue, 6 Jan 2026 13:45:07 +0900 (JST) Received: from iyokan3.css.socionext.com ([172.31.9.53]) by m-FILTER with ESMTP; Tue, 6 Jan 2026 13:45:07 +0900 Received: from [10.212.247.110] (unknown [10.212.247.110]) by iyokan3.css.socionext.com (Postfix) with ESMTP id 66FE810A003; Tue, 6 Jan 2026 13:45:06 +0900 (JST) Message-ID: Date: Tue, 6 Jan 2026 13:45:09 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] phy: socionext: usb2: Simplify with scoped for each OF child loop To: Krzysztof Kozlowski , Vinod Koul , Neil Armstrong , Masami Hiramatsu References: <20260102124848.64474-2-krzysztof.kozlowski@oss.qualcomm.com> Content-Language: en-US Cc: linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Kunihiko Hayashi In-Reply-To: <20260102124848.64474-2-krzysztof.kozlowski@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Krzysztof, On 2026/01/02 21:48, Krzysztof Kozlowski wrote: > Use scoped for-each loop when iterating over device nodes to make code a > bit simpler. > > Signed-off-by: Krzysztof Kozlowski > --- > drivers/phy/socionext/phy-uniphier-usb2.c | 28 ++++++++--------------- > 1 file changed, 10 insertions(+), 18 deletions(-) > > diff --git a/drivers/phy/socionext/phy-uniphier-usb2.c > b/drivers/phy/socionext/phy-uniphier-usb2.c > index 21c201717d95..c49d432e526b 100644 > --- a/drivers/phy/socionext/phy-uniphier-usb2.c > +++ b/drivers/phy/socionext/phy-uniphier-usb2.c > @@ -106,7 +106,7 @@ static const struct phy_ops uniphier_u2phy_ops = { > static int uniphier_u2phy_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct device_node *parent, *child; > + struct device_node *parent; > struct uniphier_u2phy_priv *priv = NULL, *next = NULL; > struct phy_provider *phy_provider; > struct regmap *regmap; > @@ -129,34 +129,31 @@ static int uniphier_u2phy_probe(struct > platform_device *pdev) > return PTR_ERR(regmap); > } > > - for_each_child_of_node(dev->of_node, child) { > + for_each_child_of_node_scoped(dev->of_node, child) { > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > - if (!priv) { > - ret = -ENOMEM; > - goto out_put_child; > - } > + if (!priv) > + return -ENOMEM; > + > priv->regmap = regmap; > > priv->vbus = devm_regulator_get_optional(dev, "vbus"); > if (IS_ERR(priv->vbus)) { > - if (PTR_ERR(priv->vbus) == -EPROBE_DEFER) { > - ret = PTR_ERR(priv->vbus); > - goto out_put_child; > - } > + if (PTR_ERR(priv->vbus) == -EPROBE_DEFER) > + return PTR_ERR(priv->vbus); > + > priv->vbus = NULL; > } > > priv->phy = devm_phy_create(dev, child, > &uniphier_u2phy_ops); > if (IS_ERR(priv->phy)) { > dev_err(dev, "Failed to create phy\n"); > - ret = PTR_ERR(priv->phy); > - goto out_put_child; > + return PTR_ERR(priv->phy); > } > > ret = of_property_read_u32(child, "reg", &data_idx); > if (ret) { > dev_err(dev, "Failed to get reg property\n"); > - goto out_put_child; > + return ret; > } > > if (data_idx < ndatas) > @@ -174,11 +171,6 @@ static int uniphier_u2phy_probe(struct > platform_device *pdev) > phy_provider = devm_of_phy_provider_register(dev, > > uniphier_u2phy_xlate); > return PTR_ERR_OR_ZERO(phy_provider); > - > -out_put_child: > - of_node_put(child); > - > - return ret; > } > > static const struct uniphier_u2phy_soc_data uniphier_pro4_data[] = { Reviewed-by: Kunihiko Hayashi Thank you, --- Best Regards Kunihiko Hayashi