das1800: don't access *data when insn->bits == 0
authorIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 20:57:29 +0000 (20:57 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 15 Dec 2011 20:57:29 +0000 (20:57 +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/das1800.c

index d35b67e5f67c2f8db2a21b487a2aaaff7d13242d..1e0defe4507819d816f15fa9587a352ac11b61be 100644 (file)
@@ -1621,6 +1621,9 @@ static int das1800_ao_winsn(comedi_device * dev, comedi_subdevice * s,
        short output;
        unsigned long irq_flags;
 
+       if (insn->n == 0)
+               return 0;
+
        //  card expects two's complement data
        output = data[0] - (1 << (thisboard->resolution - 1));
        // if the write is to the 'update' channel, we need to remember its value