David Kershner <david.kersh...@unisys.com> writes:
> Visordriver_probe_device gotos were messy, clean them up.
>
> Signed-off-by: David Kershner <david.kersh...@unisys.com>
> Signed-off-by: Timothy Sell <timothy.s...@unisys.com>
> ---
>  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();
>       get_device(&dev->device);
>       if (!drv->probe) {
> -             up(&dev->visordriver_callback_lock);
>               rc = -ENODEV;
> -             goto away;
> +             goto err_put_and_up;
>       }
>       rc = drv->probe(dev);
>       if (rc < 0)
> -             goto away;
> +             goto err_put_and_up;
>  
>       fix_vbus_dev_info(dev);
>       up(&dev->visordriver_callback_lock);
> +     return 0; /* success: reference kept via unmatched get_device() */
>       rc = 0;
> -away:
> -     if (rc != 0)
> -             put_device(&dev->device);
> +
> +err_put_and_up:
> +     put_device(&dev->device);
> +     up(&dev->visordriver_callback_lock);
>       return rc;
>  }

David,

This doesn't look right - you add a return 0 but then leave the rc = 0
assignment below it, which will never get executed given the goto label
is further down.

Why this obsession with getting rid of the gotos?

Cheers,
Jes
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to