* [PATCH 1/1 linux-next] hp100: simplify hp100_module_init
@ 2015-01-03 13:44 Fabian Frederick
2015-01-05 3:23 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2015-01-03 13:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Fabian Frederick, Jaroslav Kysela, netdev
-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 <fabf@skynet.be>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1 linux-next] hp100: simplify hp100_module_init
2015-01-03 13:44 [PATCH 1/1 linux-next] hp100: simplify hp100_module_init Fabian Frederick
@ 2015-01-05 3:23 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-05 3:23 UTC (permalink / raw)
To: fabf; +Cc: linux-kernel, perex, netdev
From: Fabian Frederick <fabf@skynet.be>
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 <fabf@skynet.be>
> ---
> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-05 3:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-03 13:44 [PATCH 1/1 linux-next] hp100: simplify hp100_module_init Fabian Frederick
2015-01-05 3:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).