Subject: Re: [PATCH 5/19] PCI: rpaphp: Remove un-needed goto

From: [email-masked] (Linas Vepstas)
Date: Tue, 3 Apr 2007 10:59:28 -0500

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