diff mbox series

sparc: kernel: Add missing put_device() calls

Message ID 20220415135910.87598-1-hanyihao@vivo.com
State New
Headers show
Series sparc: kernel: Add missing put_device() calls | expand

Commit Message

Yihao Han April 15, 2022, 1:59 p.m. UTC
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

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/sparc/kernel/pci_sabre.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 3c38ca40a22b..5d0d13840ac3 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -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)