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

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

staging: comedi: drivers: propogate errno from subdev_8255_init()



The initialization of the 8255 subdevice can fail due to the allocation
of the private data. Make sure all callers of subdev_8255_init() propogate
the errno.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 52a1c19d
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1130,10 +1130,12 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
	for (i = 0; i < MAX_DIO_SUBDEVG; i++)
		for (j = 0; j < this_board->sdio[i].regs; j++) {
			s = &dev->subdevices[subdev];
			subdev_8255_init(dev, s, NULL,
			ret = subdev_8255_init(dev, s, NULL,
					       dev->iobase +
					       this_board->sdio[i].addr +
					       SIZE_8255 * j);
			if (ret)
				return ret;
			subdev++;
		}

+8 −5
Original line number Diff line number Diff line
@@ -3816,16 +3816,19 @@ static int setup_subdevices(struct comedi_device *dev)
	if (thisboard->has_8255) {
		if (thisboard->layout == LAYOUT_4020) {
			dio_8255_iobase = devpriv->main_iobase + I8255_4020_REG;
			subdev_8255_init(dev, s, dio_callback_4020,
			ret = subdev_8255_init(dev, s, dio_callback_4020,
					       (unsigned long)dio_8255_iobase);
		} else {
			dio_8255_iobase =
				devpriv->dio_counter_iobase + DIO_8255_OFFSET;
			subdev_8255_init(dev, s, dio_callback,
			ret = subdev_8255_init(dev, s, dio_callback,
					       (unsigned long)dio_8255_iobase);
		}
	} else
		if (ret)
			return ret;
	} else {
		s->type = COMEDI_SUBD_UNUSED;
	}

	/*  8 channel dio for 60xx */
	s = &dev->subdevices[5];
+3 −1
Original line number Diff line number Diff line
@@ -247,7 +247,9 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,

	s = &dev->subdevices[2];
	/* digital i/o subdevice */
	subdev_8255_init(dev, s, NULL, iobase_8255);
	ret = subdev_8255_init(dev, s, NULL, iobase_8255);
	if (ret)
		return ret;

	dev_info(dev->class_dev, "%s attached\n", dev->board_name);

+4 −3
Original line number Diff line number Diff line
@@ -529,9 +529,10 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
	s = &dev->subdevices[4];
	/* 8255 */
	if (thisboard->i8255_offset != 0) {
		subdev_8255_init(dev, s, NULL, (unsigned long)(dev->iobase +
							       thisboard->
							       i8255_offset));
		ret = subdev_8255_init(dev, s, NULL,
				       dev->iobase + thisboard->i8255_offset);
		if (ret)
			return ret;
	} else {
		s->type = COMEDI_SUBD_UNUSED;
	}
+6 −3
Original line number Diff line number Diff line
@@ -723,10 +723,13 @@ static int atmio16d_attach(struct comedi_device *dev,

	/* 8255 subdevice */
	s = &dev->subdevices[3];
	if (board->has_8255)
		subdev_8255_init(dev, s, NULL, dev->iobase);
	else
	if (board->has_8255) {
		ret = subdev_8255_init(dev, s, NULL, dev->iobase);
		if (ret)
			return ret;
	} else {
		s->type = COMEDI_SUBD_UNUSED;
	}

/* don't yet know how to deal with counter/timers */
#if 0
Loading