Skip to contentSkip to conversation

ARM: mstar: Drop OF node references after mapping

PATCH In review Yuho Choi 2 participants 3 messages Jun 8 – Jul 3

Subsystems (3)
lore
Share & tools
lore

Yuho Choi

author
#0 lore raw

PATCH 1/1 ARM: mstar: Drop OF node references after mapping

of_find_compatible_node() returns a device node with its reference count incremented. of_iomap() uses the node to map the register range, but does not consume that reference.

Drop the node references after mapping the smpctrl and l3bridge registers.

Fixes 312b62b6610c ("ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs")
Fixes 5919eec0f092 ("ARM: mstar: SMP support")
---
 arch/arm/mach-mstar/mstarv7.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-mstar/mstarv7.c +2 -0
index 274c4f0df270..64262b8f10a0 100644
@@ -86,6 +86,7 @@ static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 	np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
 	smpctrl = of_iomap(np, 0);
+	of_node_put(np);
 
 	if (!smpctrl)
 		return -ENODEV;
@@ -116,6 +117,7 @@ static void __init mstarv7_init(void)
 
 	np = of_find_compatible_node(NULL, NULL, "mstar,l3bridge");
 	l3bridge = of_iomap(np, 0);
+	of_node_put(np);
 	if (l3bridge)
 		soc_mb = mstarv7_mb;
 	else
Signature · 1 line
2.43.0
author
#1 lore raw

Hi,

Just a gentle ping on this patch.

I would appreciate any feedback when you have a chance to review this.

Thanks

Quoted 38 lines · Yuho Choi

of_find_compatible_node() returns a device node with its reference count incremented. of_iomap() uses the node to map the register range, but does not consume that reference.

Drop the node references after mapping the smpctrl and l3bridge registers.

Fixes 312b62b6610c ("ARM: mstar: Add machine for MStar/Sigmastar Armv7 SoCs")
Fixes 5919eec0f092 ("ARM: mstar: SMP support")
---
 arch/arm/mach-mstar/mstarv7.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-mstar/mstarv7.c +2 -1
index 274c4f0df270..64262b8f10a0 100644
@@ -86,6 +86,7 @@ static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
        np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
        smpctrl = of_iomap(np, 0);
+       of_node_put(np);
 
        if (!smpctrl)
                return -ENODEV;
@@ -116,6 +117,7 @@ static void __init mstarv7_init(void)
 
        np = of_find_compatible_node(NULL, NULL, "mstar,l3bridge");
        l3bridge = of_iomap(np, 0);
+       of_node_put(np);
        if (l3bridge)
                soc_mb = mstarv7_mb;
        else
--

2.43.0

maintainer
#2 lore raw

Hi,

Quoted 8 lines · 최유호

Hi,

Just a gentle ping on this patch.

I would appreciate any feedback when you have a chance to review this.

Thanks

In my opinion this doesn't really do anything. But since people are sending the same patches (I guess because they have a tool finding common patterns) I would accept a patch just to stop getting the same patch again. :)

If we have to do this is there not a cleanup helper we can use to let the compiler do it?

Thanks,

Daniel

- Sorry for the spam, gmail did its gmail thing where it decided I want html email despite telling it I want plaintext in the settings.