]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: chemical: scd4x: fix reported channel endianness
authorFiona Klute <fiona.klute@gmx.de>
Sat, 13 Dec 2025 16:32:26 +0000 (17:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Jan 2026 09:27:38 +0000 (10:27 +0100)
commitc2d6e00829cbf87129242fdb54b188eb73a82c5d
treee5f287d6a8eb61d87b8ce6c06fc59a0adc34cd69
parent9795fe80976f8c31cafda7d44edfc0f532d1f7c4
iio: chemical: scd4x: fix reported channel endianness

commit 81d5a5366d3c20203fb9d7345e1aa46d668445a2 upstream.

The driver converts values read from the sensor from BE to CPU
endianness in scd4x_read_meas(). The result is then pushed into the
buffer in scd4x_trigger_handler(), so on LE architectures parsing the
buffer using the reported BE type gave wrong results.

scd4x_read_raw() which provides sysfs *_raw values is not affected, it
used the values returned by scd4x_read_meas() without further
conversion.

Fixes: 49d22b695cbb6 ("drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensor")
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/chemical/scd4x.c