Skip to content

Commit 0d5a213

Browse files
krzkvinodkoul
authored andcommitted
phy: ti: j721e-wiz: Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent afd7aaf commit 0d5a213

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/phy/ti/phy-j721e-wiz.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,15 +1404,15 @@ MODULE_DEVICE_TABLE(of, wiz_id_table);
14041404

14051405
static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz)
14061406
{
1407-
struct device_node *serdes, *subnode;
1407+
struct device_node *serdes;
14081408

14091409
serdes = of_get_child_by_name(dev->of_node, "serdes");
14101410
if (!serdes) {
14111411
dev_err(dev, "%s: Getting \"serdes\"-node failed\n", __func__);
14121412
return -EINVAL;
14131413
}
14141414

1415-
for_each_child_of_node(serdes, subnode) {
1415+
for_each_child_of_node_scoped(serdes, subnode) {
14161416
u32 reg, num_lanes = 1, phy_type = PHY_NONE;
14171417
int ret, i;
14181418

@@ -1422,7 +1422,6 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz)
14221422

14231423
ret = of_property_read_u32(subnode, "reg", &reg);
14241424
if (ret) {
1425-
of_node_put(subnode);
14261425
dev_err(dev,
14271426
"%s: Reading \"reg\" from \"%s\" failed: %d\n",
14281427
__func__, subnode->name, ret);

0 commit comments

Comments
 (0)