staging: comedi: pcl818: only init async command members when needed
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 3 Dec 2013 19:07:18 +0000 (12:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 23:25:31 +0000 (15:25 -0800)
The 'len_chanlist' and 'cancel' members of the comedi_subdevice are
only used with async command support. Only initialize them if the irq
was sucessfully requested.

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

index e1fef1b575478daad3bc34898111042a8d1188bd..ad1f347066435b96cc472e24202a5eb9e022efd0 100644 (file)
@@ -1279,15 +1279,15 @@ no_dma:
                        s->subdev_flags |= SDF_DIFF;
                }
                s->maxdata = board->ai_maxdata;
-               s->len_chanlist = s->n_chan;
                s->range_table = board->ai_range_type;
-               s->cancel = pcl818_ai_cancel;
                s->insn_read = pcl818_ai_insn_read;
                if (dev->irq) {
                        dev->read_subdev = s;
                        s->subdev_flags |= SDF_CMD_READ;
+                       s->len_chanlist = s->n_chan;
                        s->do_cmdtest = ai_cmdtest;
                        s->do_cmd = ai_cmd;
+                       s->cancel = pcl818_ai_cancel;
                }
                if (board->is_818) {
                        if ((it->options[4] == 1) || (it->options[4] == 10))