From 0fa8e47dea17dd7899201f73cdf3d8efcbf78448 Mon Sep 17 00:00:00 2001 From: Syed Nayyar Waris Date: Thu, 2 Jul 2026 02:28:57 +0530 Subject: [PATCH] isa: refactor code to remove nested blocks Remove nested blocks in isa_bus_init(). This will make the module easy-to-understand and make the code clearer. Previous discussion regarding this change can be found at below link: https://lore.kernel.org/all/20260504063518.515620-1-wbg@kernel.org/ Acked-by: William Breathitt Gray Suggested-by: William Breathitt Gray Signed-off-by: Syed Nayyar Waris Acked-by: Randy Dunlap Link: https://lore.kernel.org/all/20260504063518.515620-1-wbg@kernel.org/ Link: https://patch.msgid.link/20260701205857.GA4113@syednwaris Signed-off-by: Danilo Krummrich --- drivers/base/isa.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/base/isa.c b/drivers/base/isa.c index 5887e4211f80..4e9f68080f39 100644 --- a/drivers/base/isa.c +++ b/drivers/base/isa.c @@ -166,14 +166,16 @@ static int __init isa_bus_init(void) int error; error = bus_register(&isa_bus_type); - if (!error) { - isa_bus = root_device_register("isa"); - if (IS_ERR(isa_bus)) { - error = PTR_ERR(isa_bus); - bus_unregister(&isa_bus_type); - } + if (error) + return error; + + isa_bus = root_device_register("isa"); + if (IS_ERR(isa_bus)) { + bus_unregister(&isa_bus_type); + return PTR_ERR(isa_bus); } - return error; + + return 0; } postcore_initcall(isa_bus_init);