]> Git Repo - linux.git/commitdiff
dsa: fix for_each_child.cocci warnings
authorkernel test robot <[email protected]>
Sun, 11 Jul 2021 16:12:56 +0000 (18:12 +0200)
committerDavid S. Miller <[email protected]>
Sun, 11 Jul 2021 17:01:55 +0000 (10:01 -0700)
For_each_available_child_of_node should have of_node_put() before
return around line 423.

Generated by: scripts/coccinelle/iterators/for_each_child.cocci

CC: Alexander Lobakin <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/dsa/microchip/ksz_common.c

index a7e5ac60baef23ac88d25d2f10509c4212433ab0..1542bfb8b5e54a595ef822a679d6725c8f7eb85e 100644 (file)
@@ -419,8 +419,10 @@ int ksz_switch_register(struct ksz_device *dev,
                                if (of_property_read_u32(port, "reg",
                                                         &port_num))
                                        continue;
-                               if (!(dev->port_mask & BIT(port_num)))
+                               if (!(dev->port_mask & BIT(port_num))) {
+                                       of_node_put(port);
                                        return -EINVAL;
+                               }
                                of_get_phy_mode(port,
                                                &dev->ports[port_num].interface);
                        }
This page took 0.061393 seconds and 4 git commands to generate.