diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-06-12 11:59:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-12 14:44:04 -0700 |
commit | 8b6c56949ffa83dbc2a6e8fa3f98b10a19372207 (patch) | |
tree | 71fb0a053eca4f23efdca55f479554ba037ee987 /drivers/staging/comedi/drivers/poc.c | |
parent | staging: comedi: remove the "Allocate the subdevice..." comments (diff) | |
download | linux-dev-8b6c56949ffa83dbc2a6e8fa3f98b10a19372207.tar.xz linux-dev-8b6c56949ffa83dbc2a6e8fa3f98b10a19372207.zip |
staging: comedi: propogate error code from comedi_alloc_subdevices
comedi_alloc_subdevices can fail with -EINVAL or -ENOMEM. When it
does fail make sure to pass the proper error code back.
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/poc.c')
-rw-r--r-- | drivers/staging/comedi/drivers/poc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index 1e954f9c4165..a129ccace93d 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -139,6 +139,7 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; unsigned long iobase; unsigned int iosize; + int ret; iobase = it->options[0]; printk(KERN_INFO "comedi%d: poc: using %s iobase 0x%lx\n", dev->minor, @@ -160,8 +161,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = iobase; - if (comedi_alloc_subdevices(dev, 1) < 0) - return -ENOMEM; + ret = comedi_alloc_subdevices(dev, 1); + if (ret) + return ret; + if (alloc_private(dev, sizeof(unsigned int) * board->n_chan) < 0) return -ENOMEM; |