staging: comedi: cb_pcidas64: Use insn->n in AO insn_write handler
authorIan Abbott <abbotti@mev.co.uk>
Tue, 30 Oct 2018 14:17:11 +0000 (14:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:05:38 +0000 (13:05 +0100)
commit130151991dcb14e5c383c730b3ef37a6fdc32c95
treea747ccb05b2fe50ae8df0520d6bfe33a414c346c
parentfafb85b45f68e95e784d025696512ea062c00bd4
staging: comedi: cb_pcidas64: Use insn->n in AO insn_write handler

The `insn_write` handler for the AO subdevice (`ao_winsn()` currently
ignores `insn->n` (the number of samples to write) and assumes a single
sample is to be written.  But `insn->n` could be 0, meaning no samples
should be written, in which case `data[0]` is invalid.

Follow the usual Comedi guidelines and change `ao_winsn()` to write the
specified number of samples.  This fixes the assumption that `data[0]`
is valid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/cb_pcidas64.c