Skip to contentSkip to conversation

staging: comedi: cb_das16_cs: probe for the device first

PATCH In review H Hartley Sweeten 1 participant 1 message Jun 26, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 22/33 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.

Cc Ian Abbott <[email protected]>
Cc Frank Mori Hess <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/cb_das16_cs.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/staging/comedi/drivers/cb_das16_cs.c +7 -9
index 2d8ec68..20d77cf 100644
@@ -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;
 
Signature · 1 line
1.7.11