From 07766380c8249d53f2cf8b5df7faefad0644b349 Mon Sep 17 00:00:00 2001 From: Mario Tesi Date: Fri, 3 Mar 2023 10:49:38 +0100 Subject: [PATCH] drivers:iio:stm:imu:st_asm330lhhx: avoid to set invalid odr values Prevent applying invalid odr values to the device, especially the null value. Signed-off-by: Mario Tesi Change-Id: I6eca531089c8ef4663dbd886804a91f98c881425 Reviewed-on: https://gerrit.st.com/c/linuxandroidopen/stm-ldd-iio/+/293585 Reviewed-by: Matteo DAMENO Tested-by: CITOOLS --- .../iio/stm/imu/st_asm330lhhx/st_asm330lhhx_core.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/iio/stm/imu/st_asm330lhhx/st_asm330lhhx_core.c b/drivers/iio/stm/imu/st_asm330lhhx/st_asm330lhhx_core.c index 46f5de76f1d5..c7c529b4f7ff 100644 --- a/drivers/iio/stm/imu/st_asm330lhhx/st_asm330lhhx_core.c +++ b/drivers/iio/stm/imu/st_asm330lhhx/st_asm330lhhx_core.c @@ -1001,16 +1001,6 @@ int st_asm330lhhx_get_odr_val(enum st_asm330lhhx_sensor_id id, int odr, int sensor_odr; int i; - if (required_odr == 0) { - *val = 0; - if (podr && puodr) { - *podr = 0; - *puodr = 0; - } - - return 0; - } - for (i = 0; i < st_asm330lhhx_odr_table[id].size; i++) { sensor_odr = ST_ASM330LHHX_ODR_EXPAND( st_asm330lhhx_odr_table[id].odr_avl[i].hz, @@ -1428,7 +1418,7 @@ static int st_asm330lhhx_write_raw(struct iio_dev *iio_dev, err = st_asm330lhhx_get_odr_val(s->id, val, val2, &todr, &tuodr, &data); if (!err) { - s->odr = val; + s->odr = todr; s->uodr = tuodr; /*