Skip to contentSkip to conversation

fsl_hypervisor: Add missing of_node_put in fsl_hypervisor_init

PATCH In review He Ying 1 participant 2 messages Oct 29, 2021 – Nov 9, 2021

lore
Share & tools
lore

He Ying

author
#0 lore raw

PATCH 1/1 fsl_hypervisor: Add missing of_node_put in fsl_hypervisor_init

Early exits from for_each_compatible_node() should decrement the node reference counter.

Fixes 6db7199407ca ("drivers/virt: introduce Freescale hypervisor management driver")
---
 drivers/virt/fsl_hypervisor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virt/fsl_hypervisor.c +3 -1
index 46ee0a0998b6..ef5fcca4b8f0 100644
@@ -849,8 +849,10 @@ static int __init fsl_hypervisor_init(void)
 		}
 
 		dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
-		if (!dbisr)
+		if (!dbisr) {
+			of_node_put(np);
 			goto out_of_memory;
+		}
 
 		dbisr->irq = irq;
 		dbisr->doorbell = be32_to_cpup(handle);
Signature · 1 line
2.17.1
author
#1 lore raw

kindly ping...

Quoted 25 lines · He Ying

Early exits from for_each_compatible_node() should decrement the node reference counter.

Fixes 6db7199407ca ("drivers/virt: introduce Freescale hypervisor management driver")
---
  drivers/virt/fsl_hypervisor.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virt/fsl_hypervisor.c +3 -1
index 46ee0a0998b6..ef5fcca4b8f0 100644
@@ -849,8 +849,10 @@ static int __init fsl_hypervisor_init(void)
  		}
 
  		dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
-		if (!dbisr)
+		if (!dbisr) {
+			of_node_put(np);
  			goto out_of_memory;
+		}
 
  		dbisr->irq = irq;
  		dbisr->doorbell = be32_to_cpup(handle);