]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: dac: ds4424: reject -128 RAW value
authorOleksij Rempel <o.rempel@pengutronix.de>
Wed, 4 Feb 2026 14:00:33 +0000 (15:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Mar 2026 15:15:29 +0000 (16:15 +0100)
commit8d6a232f918eac3b5dd05481f9902c1d8f4d5204
tree23b09634eeca69b5746f15bca0e7c30a44463520
parente7b9356d8f4a6864529e0436f0dcc604d3b63b69
iio: dac: ds4424: reject -128 RAW value

commit 5187e03b817c26c1c3bcb2645a612ea935c4be89 upstream.

The DS442x DAC uses sign-magnitude encoding, so -128 cannot be represented
in hardware (7-bit magnitude).

Previously, passing -128 resulted in a truncated value that programmed
0mA (magnitude 0) instead of the expected maximum negative current,
effectively failing silently.

Reject -128 to avoid producing the wrong current.

Fixes: d632a2bd8ffc ("iio: dac: ds4422/ds4424 dac driver")
Cc: stable@vger.kernel.org
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/dac/ds4424.c