staging: comedi: only set dev->n_subdevices when kcalloc succeedes
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 12 Jun 2012 18:58:27 +0000 (11:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jun 2012 21:44:03 +0000 (14:44 -0700)
commitfba1d0faf726b442ab8771d5e9fbaf5f5a4c624c
treea0725fb72c1cb5091be27d05a338eae2bed6fe78
parent7f801c41714729f7741a042de839918be2bb56f0
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>
drivers/staging/comedi/drivers.c
drivers/staging/comedi/drivers/comedi_test.c
drivers/staging/comedi/drivers/ni_660x.c
drivers/staging/comedi/drivers/s526.c
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxfast.c
drivers/staging/comedi/drivers/usbduxsigma.c