staging: comedi: cb_pcidda: Use insn->n in AO insn_write handler
authorIan Abbott <abbotti@mev.co.uk>
Tue, 30 Oct 2018 14:44:16 +0000 (14:44 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:05:39 +0000 (13:05 +0100)
commit43818b03c518b7aed6bbe95ce2bcd4c5aaed2473
tree8751325f55d22122d04dbf5445fb74870cdc6a35
parent48164754d7fe219911b7653449a4ce85d23c3556
staging: comedi: cb_pcidda: Use insn->n in AO insn_write handler

The `insn_write` handler for the AO subdevice
(`cb_pcidda_ao_insn_write()`) 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
`cb_pcidda_ao_insn_write()` 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_pcidda.c