Skip to contentSkip to conversation

sparc: kernel: Add missing put_device() calls

PATCH New Yihao Han 1 participant 1 message Apr 15, 2022 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Yihao Han

author
#0 lore raw

PATCH 1/1 sparc: kernel: Add missing put_device() calls

A coccicheck run provided information like the following.

arch/sparc/kernel/pci_sabre.c:335:2-8: ERROR: missing put_device; call of_find_device_by_node on line 324, but without a corresponding object release within this function. arch/sparc/kernel/pci_sabre.c:369:0-1: ERROR: missing put_device; call of_find_device_by_node on line 324, but without a corresponding object release within this function.

Generated by: scripts/coccinelle/free/put_device.cocci

---
 arch/sparc/kernel/pci_sabre.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/sparc/kernel/pci_sabre.c +4 -1
index 3c38ca40a22b..5d0d13840ac3 100644
@@ -331,8 +331,10 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
 	 * 2: CE ERR
 	 * 3: POWER FAIL
 	 */
-	if (op->archdata.num_irqs < 4)
+	if (op->archdata.num_irqs < 4) {
+		put_device(op);
 		return;
+	}
 
 	/* We clear the error bits in the appropriate AFSR before
 	 * registering the handler so that we don't get spurious
@@ -366,6 +368,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
 	tmp = upa_readq(base + SABRE_PCICTRL);
 	tmp |= SABRE_PCICTRL_ERREN;
 	upa_writeq(tmp, base + SABRE_PCICTRL);
+	put_device(op);
 }
 
 static void apb_init(struct pci_bus *sabre_bus)
Signature · 1 line
2.17.1