From 77ebc7f8d65f976af8ba79f236061ea4361fa0cb Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 15 Dec 2011 20:47:07 +0000 Subject: [PATCH] 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 --- comedi/drivers/quatech_daqp_cs.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.26.2