[PATCH 19/22] staging: comedi: vmk80xx: rename 'boardinfo' variables
Sudip Mukherjee
sudipm.mukherjee at gmail.com
Thu Jun 18 08:02:50 UTC 2015
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 at 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
More information about the devel
mailing list