diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-06-12 11:58:27 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-12 14:44:03 -0700 |
commit | fba1d0faf726b442ab8771d5e9fbaf5f5a4c624c (patch) | |
tree | a0725fb72c1cb5091be27d05a338eae2bed6fe78 /drivers/staging/comedi/drivers/usbduxfast.c | |
parent | 7f801c41714729f7741a042de839918be2bb56f0 (diff) |
staging: comedi: only set dev->n_subdevices when kcalloc succeedes
It's possible for the kcalloc in comedi_alloc_subdevices to fail.
Only set the dev->n_subdevices variable if the allocation is
successful.
Since the core sets dev->n_subdevices, remove all the places in the
drivers where this variable was getting set.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbott@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/usbduxfast.c')
-rw-r--r-- | drivers/staging/comedi/drivers/usbduxfast.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index b2f7350c429f..262556ebc4db 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -127,11 +127,6 @@ #define NUMUSBDUXFAST 16 /* - * number of subdevices - */ -#define N_SUBDEVICES 1 - -/* * analogue in subdevice */ #define SUBDEV_AD 0 @@ -1671,11 +1666,8 @@ static int usbduxfast_attach(struct comedi_device *dev, dev->board_name = BOARDNAME; - /* set number of subdevices */ - dev->n_subdevices = N_SUBDEVICES; - /* allocate space for the subdevices */ - ret = comedi_alloc_subdevices(dev, N_SUBDEVICES); + ret = comedi_alloc_subdevices(dev, 1); if (ret < 0) { printk(KERN_ERR "comedi%d: usbduxfast: error alloc space for " "subdev\n", dev->minor); |