[PATCH 5/19] PCI: rpaphp: Remove un-needed goto
Linas Vepstas
linas at austin.ibm.com
Wed Apr 4 01:59:28 EST 2007
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
More information about the Linuxppc-dev
mailing list