From 065124e1a89b0a11017291191eed09cf5bf413ec Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 15 Dec 2011 20:01:53 +0000 Subject: [PATCH] dt2801: 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/dt2801.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comedi/drivers/dt2801.c b/comedi/drivers/dt2801.c index 15a53eb4..b39550e0 100644 --- a/comedi/drivers/dt2801.c +++ b/comedi/drivers/dt2801.c @@ -630,6 +630,9 @@ static int dt2801_ai_insn_read(comedi_device * dev, comedi_subdevice * s, static int dt2801_ao_insn_read(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) { + if (insn->n == 0) + return 0; + data[0] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; return 1; @@ -638,6 +641,9 @@ static int dt2801_ao_insn_read(comedi_device * dev, comedi_subdevice * s, static int dt2801_ao_insn_write(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) { + if (insn->n == 0) + return 0; + dt2801_writecmd(dev, DT_C_WRITE_DAIM); dt2801_writedata(dev, CR_CHAN(insn->chanspec)); dt2801_writedata2(dev, data[0]); -- 2.26.2