]> git.baikalelectronics.ru Git - kernel.git/commit
iio: dac: cio-dac: Fix max DAC write value check for 12-bit
authorWilliam Breathitt Gray <william.gray@linaro.org>
Sat, 11 Mar 2023 00:22:48 +0000 (19:22 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:07:34 +0000 (12:07 +0200)
commit77d91a44199cad61270bf196e015d5a512d9697c
tree50fdc935c80875b983d5f7240569f90a2d4c8cda
parent796169a915f5495ca2603f1d32c5cb720c33ae12
iio: dac: cio-dac: Fix max DAC write value check for 12-bit

commit c3701185ee1973845db088d8b0fc443397ab0eb2 upstream.

The CIO-DAC series of devices only supports DAC values up to 12-bit
rather than 16-bit. Trying to write a 16-bit value results in only the
lower 12 bits affecting the DAC output which is not what the user
expects. Instead, adjust the DAC write value check to reject values
larger than 12-bit so that they fail explicitly as invalid for the user.

Fixes: 9ecdeea135a6 ("iio: Add IIO support for the Measurement Computing CIO-DAC family")
Cc: stable@vger.kernel.org
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/20230311002248.8548-1-william.gray@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/dac/cio-dac.c