On Wed, Jun 17, 2015 at 03:22:13PM -0700, H Hartley Sweeten wrote:
> For aesthetics, rename the 'boardinfo' variables to 'board'. That name
> is more commonly used for the boardinfo pointer in comedi drivers.
> 
> Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
> ---
>  drivers/staging/comedi/drivers/vmk80xx.c | 33 
> +++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
<snip>
> @@ -791,19 +791,22 @@ static int vmk80xx_auto_attach(struct comedi_device 
> *dev,
>                              unsigned long context)
>  {
>       struct usb_interface *intf = comedi_to_usb_interface(dev);
> -     const struct vmk80xx_board *boardinfo;
> +     const struct vmk80xx_board *board = NULL;
>       struct vmk80xx_private *devpriv;
>       int ret;
>  
> -     boardinfo = &vmk80xx_boardinfo[context];
> -     dev->board_ptr = boardinfo;
> -     dev->board_name = boardinfo->name;
> +     if (context < ARRAY_SIZE(vmk80xx_boardinfo))
> +             board = &vmk80xx_boardinfo[context];
> +     if (!board)
> +             return -ENODEV;
this is more than just rename.

but won't it be better if the code just looked like:
if (context < ARRAY_SIZE(vmk80xx_boardinfo))
        board = &vmk80xx_boardinfo[context];
else
        return -ENODEV;

regards
sudip
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to