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.

net: renesas: rswitch: Convert to for_each_available_child_of_node()

Simplify rswitch_get_port_node() by using the
for_each_available_child_of_node() helper instead of manually ignoring
unavailable child nodes, and leaking a reference.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/54f544d573a64b96e01fd00d3481b10806f4d110.1738771798.git.geert+renesas@glider.be
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Geert Uytterhoeven and committed by
Jakub Kicinski
7bca2b2d 02c97223

+2 -5
+2 -5
drivers/net/ethernet/renesas/rswitch.c
··· 1287 1287 if (!ports) 1288 1288 return NULL; 1289 1289 1290 - for_each_child_of_node(ports, port) { 1290 + for_each_available_child_of_node(ports, port) { 1291 1291 err = of_property_read_u32(port, "reg", &index); 1292 1292 if (err < 0) { 1293 1293 port = NULL; 1294 1294 goto out; 1295 1295 } 1296 - if (index == rdev->etha->index) { 1297 - if (!of_device_is_available(port)) 1298 - port = NULL; 1296 + if (index == rdev->etha->index) 1299 1297 break; 1300 - } 1301 1298 } 1302 1299 1303 1300 out: