Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b6c5694 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbott@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eea6838b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -389,7 +389,7 @@ static int dev_8255_attach(struct comedi_device *dev,
	}

	ret = comedi_alloc_subdevices(dev, i);
	if (ret < 0)
	if (ret)
		return ret;

	printk(KERN_INFO "comedi%d: 8255:", dev->minor);
+4 −2
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ static int acl7225b_attach(struct comedi_device *dev,
	const struct boardtype *board = comedi_board(dev);
	struct comedi_subdevice *s;
	int iobase, iorange;
	int ret;

	iobase = it->options[0];
	iorange = board->io_range;
@@ -82,8 +83,9 @@ static int acl7225b_attach(struct comedi_device *dev,
	dev->iobase = iobase;
	dev->irq = 0;

	if (comedi_alloc_subdevices(dev, 3) < 0)
		return -ENOMEM;
	ret = comedi_alloc_subdevices(dev, 3);
	if (ret)
		return ret;

	s = dev->subdevices + 0;
	/* Relays outputs */
+1 −1
Original line number Diff line number Diff line
@@ -1688,7 +1688,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
	} else {
		n_subdevices = 7;
		ret = comedi_alloc_subdevices(dev, n_subdevices);
		if (ret < 0)
		if (ret)
			return ret;

		/*  Allocate and Initialise AI Subdevice Structures */
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device *dev)
	int n_subdevices = 9;

	ret = comedi_alloc_subdevices(dev, n_subdevices);
	if (ret < 0)
	if (ret)
		return;

	/*  Allocate and Initialise Timer Subdevice Structures */
+3 −2
Original line number Diff line number Diff line
@@ -301,8 +301,9 @@ static int pci6208_attach(struct comedi_device *dev,
	dev->iobase = io_base;
	dev->board_name = thisboard->name;

	if (comedi_alloc_subdevices(dev, 2) < 0)
		return -ENOMEM;
	retval = comedi_alloc_subdevices(dev, 2);
	if (retval)
		return retval;

	s = dev->subdevices + 0;
	/* analog output subdevice */
Loading