* [PATCH 5/19] PCI: rpaphp: Remove un-needed goto
@ 2007-04-03 17:19 Linas Vepstas
0 siblings, 0 replies; 5+ messages in thread
From: Linas Vepstas @ 2007-04-03 17:19 UTC (permalink / raw)
To: Kristen Carlson Accardi; +Cc: Andrew Morton, linuxppc-dev, pcihpd-discuss
Remove un-needed goto.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
----
drivers/pci/hotplug/rpaphp_slot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_slot.c 2007-04-03 11:04:18.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c 2007-04-03 11:04:19.000000000 -0500
@@ -157,14 +157,13 @@ int rpaphp_register_slot(struct slot *sl
/* should not try to register the same slot twice */
if (is_registered(slot)) {
err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
- retval = -EAGAIN;
- goto register_fail;
+ return -EAGAIN;
}
retval = pci_hp_register(php_slot);
if (retval) {
err("pci_hp_register failed with error %d\n", retval);
- goto register_fail;
+ return retval;
}
/* create "phy_location" file */
@@ -182,7 +181,6 @@ int rpaphp_register_slot(struct slot *sl
sysfs_fail:
pci_hp_deregister(php_slot);
-register_fail:
return retval;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 5/19] PCI: rpaphp: Remove un-needed goto
@ 2007-04-03 17:09 Linas Vepstas
0 siblings, 0 replies; 5+ messages in thread
From: Linas Vepstas @ 2007-04-03 17:09 UTC (permalink / raw)
To: Kristen, Carlson, "Accardi <kristen.c.accardi"
Cc: Andrew Morton, linuxppc-dev, pcihpd-discuss
Remove un-needed goto.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
----
drivers/pci/hotplug/rpaphp_slot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_slot.c 2007-04-03 11:04:18.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c 2007-04-03 11:04:19.000000000 -0500
@@ -157,14 +157,13 @@ int rpaphp_register_slot(struct slot *sl
/* should not try to register the same slot twice */
if (is_registered(slot)) {
err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
- retval = -EAGAIN;
- goto register_fail;
+ return -EAGAIN;
}
retval = pci_hp_register(php_slot);
if (retval) {
err("pci_hp_register failed with error %d\n", retval);
- goto register_fail;
+ return retval;
}
/* create "phy_location" file */
@@ -182,7 +181,6 @@ int rpaphp_register_slot(struct slot *sl
sysfs_fail:
pci_hp_deregister(php_slot);
-register_fail:
return retval;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb
@ 2007-04-03 0:26 Linas Vepstas
2007-04-03 0:37 ` [PATCH 5/19] PCI: rpaphp: Remove un-needed goto Linas Vepstas
0 siblings, 1 reply; 5+ messages in thread
From: Linas Vepstas @ 2007-04-03 0:26 UTC (permalink / raw)
To: Greg KH; +Cc: Andrew Morton, linuxppc-dev, linux-pci
Hi Greg,
Please queue these cleanp patches for 2.6.22; cc'ing akpm.
This is a collection of very small patches that clean up various bits and
pieces of the RPAPHP hotplug code. They eliminate about 100 lines of code,
almost without changing any function; there are a few minor bugfixes to
various error paths, and one memleak fix. Some documentation is added.
The result is, I beleive, slightly more readable, easier to understand
code. In particular, the enable/disable add/remove code paths are now
more obviously symmetrical in thier function.
--linas
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 5/19] PCI: rpaphp: Remove un-needed goto
2007-04-03 0:26 [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb Linas Vepstas
@ 2007-04-03 0:37 ` Linas Vepstas
2007-04-03 10:49 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Linas Vepstas @ 2007-04-03 0:37 UTC (permalink / raw)
To: Greg KH; +Cc: Andrew Morton, linuxppc-dev, linux-pci
Remove un-needed goto.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
----
drivers/pci/hotplug/rpaphp_slot.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_slot.c 2007-03-28 18:07:28.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c 2007-03-28 18:10:14.000000000 -0500
@@ -157,14 +157,13 @@ int rpaphp_register_slot(struct slot *sl
/* should not try to register the same slot twice */
if (is_registered(slot)) {
err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
- retval = -EAGAIN;
- goto register_fail;
+ return -EAGAIN;
}
retval = pci_hp_register(php_slot);
if (retval) {
err("pci_hp_register failed with error %d\n", retval);
- goto register_fail;
+ return retval;
}
/* create "phy_location" file */
@@ -182,7 +181,6 @@ int rpaphp_register_slot(struct slot *sl
sysfs_fail:
pci_hp_deregister(php_slot);
-register_fail:
return retval;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 5/19] PCI: rpaphp: Remove un-needed goto
2007-04-03 0:37 ` [PATCH 5/19] PCI: rpaphp: Remove un-needed goto Linas Vepstas
@ 2007-04-03 10:49 ` Christoph Hellwig
2007-04-03 15:59 ` Linas Vepstas
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2007-04-03 10:49 UTC (permalink / raw)
To: Linas Vepstas; +Cc: Andrew Morton, linuxppc-dev, linux-pci, Greg KH
> /* should not try to register the same slot twice */
> if (is_registered(slot)) {
> err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
> - retval = -EAGAIN;
> - goto register_fail;
> + return -EAGAIN;
> }
>
> retval = pci_hp_register(php_slot);
> if (retval) {
> err("pci_hp_register failed with error %d\n", retval);
> - goto register_fail;
> + return retval;
> }
>
> /* create "phy_location" file */
> @@ -182,7 +181,6 @@ int rpaphp_register_slot(struct slot *sl
>
> sysfs_fail:
> pci_hp_deregister(php_slot);
> -register_fail:
> return retval;
> }
Using a goto for just returning an error is a common idiom if we
have other failure cases aswell.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 5/19] PCI: rpaphp: Remove un-needed goto
2007-04-03 10:49 ` Christoph Hellwig
@ 2007-04-03 15:59 ` Linas Vepstas
0 siblings, 0 replies; 5+ messages in thread
From: Linas Vepstas @ 2007-04-03 15:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Andrew Morton, linuxppc-dev, linux-pci, Greg KH
On Tue, Apr 03, 2007 at 12:49:25PM +0200, Christoph Hellwig wrote:
> > /* should not try to register the same slot twice */
> > if (is_registered(slot)) {
> > err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
> > - retval = -EAGAIN;
> > - goto register_fail;
> > + return -EAGAIN;
> > }
> >
> > retval = pci_hp_register(php_slot);
> > if (retval) {
> > err("pci_hp_register failed with error %d\n", retval);
> > - goto register_fail;
> > + return retval;
> > }
> >
> > /* create "phy_location" file */
> > @@ -182,7 +181,6 @@ int rpaphp_register_slot(struct slot *sl
> >
> > sysfs_fail:
> > pci_hp_deregister(php_slot);
> > -register_fail:
> > return retval;
> > }
>
> Using a goto for just returning an error is a common idiom if we
> have other failure cases aswell.
Yes, it is, and I rather like that way of doing things. But in this case
it didn't seem warranted; I've been trying to take to heart that less
code == better code, without muntzing (ala bob pease) the code.
--linas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-04-03 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03 17:19 [PATCH 5/19] PCI: rpaphp: Remove un-needed goto Linas Vepstas
-- strict thread matches above, loose matches on Subject: below --
2007-04-03 17:09 Linas Vepstas
2007-04-03 0:26 [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb Linas Vepstas
2007-04-03 0:37 ` [PATCH 5/19] PCI: rpaphp: Remove un-needed goto Linas Vepstas
2007-04-03 10:49 ` Christoph Hellwig
2007-04-03 15:59 ` Linas Vepstas
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).