Re: [PATCH 5/6] staging: unisys: visorbus: Cleanup gotos in visordriver_probe_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 08, 2016 at 08:22:47PM -0500, David Kershner wrote:
> Visordriver_probe_device gotos were messy, clean them up.
> 
> Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
> Signed-off-by: Timothy Sell <timothy.sell@xxxxxxxxxx>
> ---
>  drivers/staging/unisys/visorbus/visorbus_main.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
> index 26e0374..6a228c8 100644
> --- a/drivers/staging/unisys/visorbus/visorbus_main.c
> +++ b/drivers/staging/unisys/visorbus/visorbus_main.c
> @@ -751,20 +751,21 @@ visordriver_probe_device(struct device *xdev)
>  	wmb();

I know it's not related to this patch, but why in the world do you have
a wmb() here?  That's really not needed, and is a sign that something is
really wrong here...


>  	get_device(&dev->device);
>  	if (!drv->probe) {
> -		up(&dev->visordriver_callback_lock);
>  		rc = -ENODEV;
> -		goto away;
> +		goto err_put_and_up;
>  	}

Why not just check before calling get_device()?

>  	rc = drv->probe(dev);
>  	if (rc < 0)
> -		goto away;
> +		goto err_put_and_up;

No need for this goto at all, just don't call your fix_vbus_dev_info()
call, and return the value given you, making this function a lot
simpler, with no goto even needed.

what a mess...

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux