linux/drivers/staging/iio
Gabriel Shahrouzi 215e42e2f1 staging: iio: adc: ad7816: Correct conditional logic for store mode
commit 2e92295627 upstream.

The mode setting logic in ad7816_store_mode was reversed due to
incorrect handling of the strcmp return value. strcmp returns 0 on
match, so the `if (strcmp(buf, "full"))` block executed when the
input was not "full".

This resulted in "full" setting the mode to AD7816_PD (power-down) and
other inputs setting it to AD7816_FULL.

Fix this by checking it against 0 to correctly check for "full" and
"power-down", mapping them to AD7816_FULL and AD7816_PD respectively.

Fixes: 7924425db0 ("staging: iio: adc: new driver for AD7816 devices")
Cc: stable@vger.kernel.org
Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/stable/20250414152920.467505-1-gshahrouzi%40gmail.com
Link: https://patch.msgid.link/20250414154050.469482-1-gshahrouzi@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-18 08:24:51 +02:00
..
accel staging: iio: accel: adis16240: Call '__adis_initial_startup()' 2022-11-23 20:37:51 +00:00
adc staging: iio: adc: ad7816: Correct conditional logic for store mode 2025-05-18 08:24:51 +02:00
addac staging: iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-06-13 19:19:23 +01:00
Documentation iio: resolver: ad2s1210: move out of staging 2023-10-12 09:20:50 +01:00
frequency staging: iio: ad9832: Correct phase range check 2025-01-17 13:40:52 +01:00
impedance-analyzer staging: iio: impedance-analyzer: ad5933: make use of iio_get_masklength() 2024-08-03 10:13:43 +01:00
Kconfig iio: resolver: ad2s1210: move out of staging 2023-10-12 09:20:50 +01:00
Makefile iio: resolver: ad2s1210: move out of staging 2023-10-12 09:20:50 +01:00
TODO staging: iio: remove mention of defunct list 2021-03-25 19:13:49 +00:00