On Thursday, June 18, 2015 1:03 AM, Sudip Mukherjee wrote: > 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. I'll split this patch to add the sanity checking as a separate step. > 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; Possibly, but all the comedi drivers currently are coded in the previous way. I'm trying to keep them consistent. If one changes we should change them all. This could be done as a separate patch. If this is done I like this better: if (context >= ARRAY_SIZE(vmk80xx_boardinfo)) return -ENODEV; board = &vmk80xx_boardinfo[context]; Regards, Hartley _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel