[PATCH 1/1 linux-next] hp100: simplify hp100_module_init

Subsystems: networking drivers, the rest

STALE4234d

2 messages, 2 authors, 2015-01-05 · open the first message on its own page

[PATCH 1/1 linux-next] hp100: simplify hp100_module_init

From: Fabian Frederick <hidden>
Date: 2015-01-03 13:44:36

-Avoid double goto and directly return err where possible.
-Remove unused labels which fixes:

drivers/net/ethernet/hp/hp100.c:3047:2: warning: label
'out3' defined but not used [-Wunused-label]

Signed-off-by: Fabian Frederick <redacted>
---
This is untested.

 drivers/net/ethernet/hp/hp100.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
index ae6e30d..7155938 100644
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -3031,26 +3031,25 @@ static int __init hp100_module_init(void)
 
 	err = hp100_isa_init();
 	if (err && err != -ENODEV)
-		goto out;
+		return err;
 #ifdef CONFIG_EISA
 	err = eisa_driver_register(&hp100_eisa_driver);
 	if (err && err != -ENODEV)
-		goto out2;
+		goto out_eisa;
+	else
+		return err;
 #endif
 #ifdef CONFIG_PCI
 	err = pci_register_driver(&hp100_pci_driver);
-	if (err && err != -ENODEV)
-		goto out3;
+	if (!err || err == -ENODEV)
+		return err;
 #endif
- out:
-	return err;
- out3:
 #ifdef CONFIG_EISA
 	eisa_driver_unregister (&hp100_eisa_driver);
- out2:
+ out_eisa:
 #endif
 	hp100_isa_cleanup();
-	goto out;
+	return err;
 }
 
 
-- 
2.1.0

Re: [PATCH 1/1 linux-next] hp100: simplify hp100_module_init

From: David Miller <davem@davemloft.net>
Date: 2015-01-05 03:23:16

From: Fabian Frederick <redacted>
Date: Sat,  3 Jan 2015 14:44:16 +0100
-Avoid double goto and directly return err where possible.
-Remove unused labels which fixes:

drivers/net/ethernet/hp/hp100.c:3047:2: warning: label
'out3' defined but not used [-Wunused-label]

Signed-off-by: Fabian Frederick <redacted>
---
This is untested.
Having a sole lone return statement that all flows of control
branch to makes the code easier to audit, than to have a huge
block where each return statement has to be audited independently
for potential cleanups.

Added to the fact that this patch is completely untested, I'm
not applying this, sorry.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help