staging: comedi: ni_nio_common: don't write non-existing caldac's
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 20 Apr 2015 18:49:05 +0000 (11:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Apr 2015 15:15:59 +0000 (17:15 +0200)
commitaccb298fb2e3d09a84bd92595b115232f14a5e60
treeaf79f09e6893cb8c7b7178fbb25cb9a598169ee1
parentb3ab6fbfd8625232c54d70e29f7274118726ba45
staging: comedi: ni_nio_common: don't write non-existing caldac's

ni_write_caldac() checks the boardinfo 'caldac' array to determine what
caldac is used for a given 'addr'. It then calculates the 'bitstring' and
number of 'bits' used to write a value to that caldac address.

After checking the caldac array, if the number of bits is 0 there is no
caldac associated with the address. If this happens we shouldn't try
writing to the non-existing caldac.

Reported-by: coverity (CID 1192116)
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_common.c