iio: adc: MCP3564: fix calib_bias and calib_scale range checks
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Fri, 1 Dec 2023 09:48:03 +0000 (10:48 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 4 Dec 2023 13:51:45 +0000 (13:51 +0000)
commit85ac6d92fdfd6097a16d9c61363fe1d0272c1604
tree4a2bbc4045304f0fe41b24675897b7f057b0873a
parent59b75dcb0953813676b5030877f3f37cedaed87d
iio: adc: MCP3564: fix calib_bias and calib_scale range checks

The current implementation uses the AND (&&) operator to check if the
value to write for IIO_CHAN_INFO_CALIBBIAS and IIO_CHAN_INFO_CALIBSCALE
is within the valid ranges.
The evaluated values are the lower and upper limits of the ranges,
so this operation always evaluates to false.

The OR (||) operator must be used instead.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Marius Cristea <marius.cristea@microchip.com>
Link: https://lore.kernel.org/r/20231201-mcp3564_range_checks-v1-1-68f4436e22b0@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/mcp3564.c