From: Ian Abbott Date: Thu, 15 Dec 2011 20:47:07 +0000 (+0000) Subject: quatech_daqp_cs: don't access *data when insn->n == 0 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77ebc7f8d65f976af8ba79f236061ea4361fa0cb;p=comedi.git quatech_daqp_cs: don't access *data when insn->n == 0 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 --- diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index b9c1a541..fb175054 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -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;