From: H Hartley Sweeten Date: Tue, 26 Jun 2012 00:11:56 +0000 (-0700) Subject: staging: comedi: cb_das16_cs: probe for the device first X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9a4d21154796136b87f841746fbdceec37bf48ee;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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: H Hartley Sweeten Cc: Ian Abbott Cc: Frank Mori Hess Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 2d8ec680a956..20d77cfe9281 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -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;