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

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

staging: comedi: cb_das16_cs: probe for the device first



During the attach of the comedi_driver, the device type probe
can fail. We should do the probe before requesting the irq
for the driver.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8c50aa15
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -454,6 +454,13 @@ static int das16cs_attach(struct comedi_device *dev,
	if (!link)
		return -EIO;

	dev->board_ptr = das16cs_probe(dev, link);
	if (!dev->board_ptr)
		return -EIO;
	thisboard = comedi_board(dev);

	dev->board_name = thisboard->name;

	dev->iobase = link->resource[0]->start;
	dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase);

@@ -461,23 +468,14 @@ static int das16cs_attach(struct comedi_device *dev,
	for (i = 0; i < 48; i += 2)
		dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i));


	ret = request_irq(link->irq, das16cs_interrupt,
			  IRQF_SHARED, "cb_das16_cs", dev);
	if (ret < 0)
		return ret;

	dev->irq = link->irq;

	dev_dbg(dev->class_dev, "irq=%u\n", dev->irq);

	dev->board_ptr = das16cs_probe(dev, link);
	if (!dev->board_ptr)
		return -EIO;
	thisboard = comedi_board(dev);

	dev->board_name = thisboard->name;

	if (alloc_private(dev, sizeof(struct das16cs_private)) < 0)
		return -ENOMEM;