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

Christoph Hellwig hch at lst.de
Tue Apr 3 20:49:25 EST 2007


>  	/* 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.



More information about the Linuxppc-dev mailing list