Re: [PATCH 19/22] staging: comedi: vmk80xx: rename 'boardinfo' variables

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

 



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 <hsweeten@xxxxxxxxxxxxxxxxxxx>
> ---
>  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
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