staging: comedi: ni_labpc_common: Use insn->n in AO insn_write handler
authorIan Abbott <abbotti@mev.co.uk>
Tue, 30 Oct 2018 17:23:54 +0000 (17:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:05:39 +0000 (13:05 +0100)
commit4a4c1b1d5a1d1f083ea9a9fe8b179bfa9e62e12a
tree28c21bacabd9a07a2308b2f33c15565454201fd0
parent43818b03c518b7aed6bbe95ce2bcd4c5aaed2473
staging: comedi: ni_labpc_common: Use insn->n in AO insn_write handler

The `insn_write` handler for the AO subdevice (`labpc_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 `labpc_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/ni_labpc_common.c