On 18/06/15 09:02, 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.
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
Also, the additional sanity check ought to be in a different patch.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Web: http://www.mev.co.uk/ )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel