@@ -180,14 +180,14 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL);
if (!newmac)
- return;
+ goto out;
newmac->value = newmac + 1;
newmac->length = 6;
newmac->name = kstrdup("local-mac-address", GFP_KERNEL);
if (!newmac->name) {
kfree(newmac);
- return;
+ goto out;
}
/*
@@ -229,6 +229,10 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
of_update_property(np, newmac);
}
+
+out:
+ of_node_put(np);
+ return;
}
static inline void enable_clk_enet_out(void)
The device_node pointer returned by of_find_compatible_node() with refcount incremented, when finish using it, the refcount need be decreased. Fixes: 5653acc24c13 ("ARM: mxs: store mac address read from OTP in device tree") Signed-off-by: Wang Yufen <wangyufen@huawei.com> --- arch/arm/mach-mxs/mach-mxs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)