Skip to contentSkip to conversation

isa: refactor code to remove nested blocks

PATCH Applied Syed Nayyar Waris 3 participants 3 messages Jul 1 – Jul 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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/[email protected]/

---
Changes in v2:
- Make the patch description more comprehensive and thorough in its explanation

---
 drivers/base/isa.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/base/isa.c +9 -7
index 5887e4211f80..4e9f68080f39 100644
@@ -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);
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Syed Nayyar Waris

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/[email protected]/

LGTM. Thanks.

Quoted 26 lines

---
Changes in v2:
- Make the patch description more comprehensive and thorough in its explanation
---
drivers/base/isa.c | 16 +++++++++-------

1 file changed, 9 insertions(+), 7 deletions(-)
drivers/base/isa.c +4 -6
index 5887e4211f80..4e9f68080f39 100644
@@ -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");

drivers/base/isa.c static int __init isa_bus_init(void) · line 181

Quoted 10 lines
drivers/base/isa.c +5 -1
+	if (IS_ERR(isa_bus)) {
+		bus_unregister(&isa_bus_type);
+		return PTR_ERR(isa_bus);
 	}
-	return error;
+
+	return 0;
 }
 
 postcore_initcall(isa_bus_init);

~Randy

maintainer Applied
#2 lore raw
In reply to Syed Nayyar Waris
Quoted 1 line · Syed Nayyar Waris

[PATCH v2] isa: refactor code to remove nested blocks

Applied, thanks!

Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git

[1/1] isa: refactor code to remove nested blocks

      commit: 0fa8e47dea17

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is in the driver-core-testing branch and will be promoted to driver-core-next after validation.