quatech_daqp_cs: don't access *data when insn->n == 0
authorIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 20:47:07 +0000 (20:47 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 20:47:07 +0000 (20:47 +0000)
Due to recent change to do_insnlist_ioctl() and do_insn_ioctl(), the
'data' pointer will be NULL when insn->n == 0.  Do not access *data
in this case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/quatech_daqp_cs.c

index b9c1a541927d9172ca50c66ebb4f7416a0959125..fb1750547f264fddc4c19ea460c5bdcd6a7598d1 100644 (file)
@@ -825,6 +825,9 @@ static int daqp_ao_insn_write(comedi_device * dev, comedi_subdevice * s,
                return -EIO;
        }
 
+       if (insn->n == 0)
+               return 0;
+
        chan = CR_CHAN(insn->chanspec);
        d = data[0];
        d &= 0x0fff;
@@ -866,6 +869,9 @@ static int daqp_do_insn_write(comedi_device * dev, comedi_subdevice * s,
                return -EIO;
        }
 
+       if (insn->n == 0)
+               return 0;
+
        outw(data[0] & 0xf, dev->iobase + DAQP_DIGITAL_IO);
 
        return 1;