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

powerpc/powermac: Drop unnecessary of_node_put

for_each_node_by_name only exits when its first argument is NULL, and a
subsequent call to of_node_put on that argument is unnecessary.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
iterator name for_each_node_by_name;
expression np,E;
identifier l;
@@

for_each_node_by_name(np,...) {
... when != break;
when != goto l;
}
... when != np = E
- of_node_put(np);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Julia Lawall and committed by
Benjamin Herrenschmidt
d1efa2a7 249ec228

-3
-1
arch/powerpc/platforms/powermac/feature.c
··· 2878 2878 core99_airport_enable(np, 0, 0); 2879 2879 } 2880 2880 } 2881 - of_node_put(np); 2882 2881 } 2883 2882 2884 2883 /* On all machines that support sound PM, switch sound off */
-2
arch/powerpc/platforms/powermac/pci.c
··· 1155 1155 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); 1156 1156 } 1157 1157 } 1158 - of_node_put(nd); 1159 1158 for_each_node_by_name(nd, "ethernet") { 1160 1159 if (nd->parent && of_device_is_compatible(nd, "gmac") 1161 1160 && of_device_is_compatible(nd->parent, "uni-north")) 1162 1161 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); 1163 1162 } 1164 - of_node_put(nd); 1165 1163 } 1166 1164 1167 1165 void pmac_pci_fixup_cardbus(struct pci_dev* dev)