staging: comedi: pcl812: allocate private data before requesting the I/O region
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 17 Feb 2014 21:27:59 +0000 (14:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 19:56:51 +0000 (11:56 -0800)
To better match the pcl818 and pcl816 drivers, allocate the private data before
calling comedi_request_region().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/pcl812.c

index a4274af..3a0dad8 100644 (file)
@@ -1247,14 +1247,14 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        int ret;
        int i;
 
-       ret = comedi_request_region(dev, it->options[0], 0x10);
-       if (ret)
-               return ret;
-
        devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
        if (!devpriv)
                return -ENOMEM;
 
+       ret = comedi_request_region(dev, it->options[0], 0x10);
+       if (ret)
+               return ret;
+
        if ((1 << it->options[1]) & board->IRQbits) {
                ret = request_irq(it->options[1], interrupt_pcl812, 0,
                                  dev->board_name, dev);