diff mbox series

ARM: mxs: fix missing of_node_put() in update_fec_mac_prop()

Message ID 1670226011-11140-1-git-send-email-wangyufen@huawei.com
State New
Headers show
Series ARM: mxs: fix missing of_node_put() in update_fec_mac_prop() | expand

Commit Message

Wang Yufen Dec. 5, 2022, 7:40 a.m. UTC
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(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 1c57ac4..5e11580 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -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)