Skip to contentSkip to conversation

isa: refactor code to remove nested blocks

PATCH Superseded Syed Nayyar Waris 2 participants 2 messages Jun 24 – Jun 26

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 isa: refactor code to remove nested blocks

Remove nested blocks in isa_bus_init()

---
 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
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Syed Nayyar Waris

Remove nested blocks in isa_bus_init()

Hi Syed,

The patch description is just repeating the subject line. Instead, you should explain why this cleanup improves the module (e.g. makes the code clearer).

You should also include a Link tag pointing to the previous discussion about this change.

Regardless, I agree with the code changes in this patch so here is my Ack.

Quoted 35 lines
---
 drivers/base/isa.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/base/isa.c +9 -8
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);
--

2.25.1