diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 5edf59ac6706..613b6b2abf7d 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -4394,9 +4394,13 @@ static int ni_calib_insn_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - ni_write_caldac(dev, CR_CHAN(insn->chanspec), data[0]); + if (insn->n) { + /* only bother writing the last sample to the channel */ + ni_write_caldac(dev, CR_CHAN(insn->chanspec), + data[insn->n - 1]); + } - return 1; + return insn->n; } static int ni_calib_insn_read(struct comedi_device *dev,