public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH] nubus: add a cleanup in nubus_init()
@ 2025-12-12 12:29 Haoxiang Li
  2025-12-12 12:40 ` Daniel Palmer
  2025-12-13  2:25 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-12-12 12:29 UTC (permalink / raw)
  To: fthain; +Cc: linux-m68k, linux-kernel, Haoxiang Li

If nubus_parent_device_register fails, call put_device()
to drop the device reference.

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/nubus/nubus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index ab0f32b901c8..21706bdcb509 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -883,8 +883,10 @@ static int __init nubus_init(void)
 
 	nubus_proc_init();
 	err = nubus_parent_device_register();
-	if (err)
+	if (err) {
+		put_device(&nubus_parent);
 		return err;
+	}
 	nubus_scan_bus();
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-13  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 12:29 [PATCH] nubus: add a cleanup in nubus_init() Haoxiang Li
2025-12-12 12:40 ` Daniel Palmer
2025-12-13  2:25 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox