Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: socionext: usb2: Simplify with scoped for each OF child loop

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://patch.msgid.link/20260102124848.64474-2-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Vinod Koul
f1674131 bc148def

+10 -18
+10 -18
drivers/phy/socionext/phy-uniphier-usb2.c
··· 106 106 static int uniphier_u2phy_probe(struct platform_device *pdev) 107 107 { 108 108 struct device *dev = &pdev->dev; 109 - struct device_node *parent, *child; 109 + struct device_node *parent; 110 110 struct uniphier_u2phy_priv *priv = NULL, *next = NULL; 111 111 struct phy_provider *phy_provider; 112 112 struct regmap *regmap; ··· 129 129 return PTR_ERR(regmap); 130 130 } 131 131 132 - for_each_child_of_node(dev->of_node, child) { 132 + for_each_child_of_node_scoped(dev->of_node, child) { 133 133 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 134 - if (!priv) { 135 - ret = -ENOMEM; 136 - goto out_put_child; 137 - } 134 + if (!priv) 135 + return -ENOMEM; 136 + 138 137 priv->regmap = regmap; 139 138 140 139 priv->vbus = devm_regulator_get_optional(dev, "vbus"); 141 140 if (IS_ERR(priv->vbus)) { 142 - if (PTR_ERR(priv->vbus) == -EPROBE_DEFER) { 143 - ret = PTR_ERR(priv->vbus); 144 - goto out_put_child; 145 - } 141 + if (PTR_ERR(priv->vbus) == -EPROBE_DEFER) 142 + return PTR_ERR(priv->vbus); 143 + 146 144 priv->vbus = NULL; 147 145 } 148 146 149 147 priv->phy = devm_phy_create(dev, child, &uniphier_u2phy_ops); 150 148 if (IS_ERR(priv->phy)) { 151 149 dev_err(dev, "Failed to create phy\n"); 152 - ret = PTR_ERR(priv->phy); 153 - goto out_put_child; 150 + return PTR_ERR(priv->phy); 154 151 } 155 152 156 153 ret = of_property_read_u32(child, "reg", &data_idx); 157 154 if (ret) { 158 155 dev_err(dev, "Failed to get reg property\n"); 159 - goto out_put_child; 156 + return ret; 160 157 } 161 158 162 159 if (data_idx < ndatas) ··· 171 174 phy_provider = devm_of_phy_provider_register(dev, 172 175 uniphier_u2phy_xlate); 173 176 return PTR_ERR_OR_ZERO(phy_provider); 174 - 175 - out_put_child: 176 - of_node_put(child); 177 - 178 - return ret; 179 177 } 180 178 181 179 static const struct uniphier_u2phy_soc_data uniphier_pro4_data[] = {