iio: imu: smi330: remove redundant assignment in smi330_read_avail
PATCH 1/1 iio: imu: smi330: remove redundant assignment in smi330_read_avail
In the IIO_CHAN_INFO_OVERSAMPLING_RATIO case, the type parameter is assigned from smi330_average_attr.type and then immediately overwritten with IIO_VAL_INT on the next line.
Since smi330_average_attr.type is already initialized to IIO_VAL_INT, the second assignment is redundant. Remove the hardcoded assignment to maintain consistency in the code.
--- drivers/iio/imu/smi330/smi330_core.c | 1 - 1 file changed, 1 deletion(-)
drivers/iio/imu/smi330/smi330_core.c +0 -1
@@ -475,7 +475,6 @@ static int smi330_read_avail(struct iio_dev *indio_dev, *vals = smi330_average_attr.vals; *length = smi330_average_attr.len; *type = smi330_average_attr.type; - *type =IIO_VAL_INT ;return IIO_AVAIL_LIST ;case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : *vals = smi330_bandwidth_attr.vals;
Signature · 1 line
2.52.0
Quoted 9 lines
Von: Massimiliano Pellizzer <[email protected]>
Gesendet: Dienstag, 25. November 2025 18:18
An: [email protected]; [email protected]; [email protected]; [email protected]; Shen Jianping (ME-SE/EAD2) <[email protected]>
Cc: [email protected]; [email protected]; Massimiliano Pellizzer <[email protected]>
Betreff: [PATCH] iio: imu: smi330: remove redundant assignment insmi330_read_avail
Quoted 7 lines
In the
IIO_CHAN_INFO_OVERSAMPLING_RATIOcase, the type parameter is assigned from smi330_average_attr.type and then immediately overwritten withIIO_VAL_INTon the next line.Since smi330_average_attr.type is already initialized to
IIO_VAL_INT, the second assignment is redundant. Remove the hardcoded assignment to maintain consistency in the code.
Looks good to me. Thank you.
Quoted 22 lines
Fixes 6f3d8de8886d ("iio: imu: smi330: Add driver")Signed-off-by Massimiliano Pellizzer <[email protected]>---
drivers/iio/imu/smi330/smi330_core.c| 1 -1 file changed, 1 deletion(-)drivers/iio/imu/smi330/smi330_core.c +0
-2@@ -475,7 +475,6 @@ static int smi330_read_avail(struct iio_dev *indio_dev, *vals = smi330_average_attr.vals; *length = smi330_average_attr.len; *type = smi330_average_attr.type; - *type =IIO_VAL_INT ;return IIO_AVAIL_LIST ;case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : *vals = smi330_bandwidth_attr.vals; --2.52.0
Jonathan Cameron
maintainerQuoted 13 lines · On Wed, 26 Nov 2025 09:56:23 +0000 "Shen Jianping (ME-SE/EAD2)"…
Quoted 13 lines
Von: Massimiliano Pellizzer <[email protected]>
Gesendet: Dienstag, 25. November 2025 18:18
An: [email protected]; [email protected]; [email protected]; [email protected]; Shen Jianping (ME-SE/EAD2) <[email protected]>
Cc: [email protected]; [email protected]; Massimiliano Pellizzer <[email protected]>
Betreff: [PATCH] iio: imu: smi330: remove redundant assignment insmi330_read_availIn the
IIO_CHAN_INFO_OVERSAMPLING_RATIOcase, the type parameter is assigned from smi330_average_attr.type and then immediately overwritten withIIO_VAL_INTon the next line.
Quoted 7 lines
Quoted 3 lines
Since smi330_average_attr.type is already initialized to
IIO_VAL_INT, the second assignment is redundant. Remove the hardcoded assignment to maintain consistency in the code.Looks good to me. Thank you.
Reviewed-by Jianping Shen <[email protected]>
I dropped the fixes tag because, as you've clearly laid out in the patch description it is redundant rather than a bug fix. Applied to my local tree
for now - I'll rebase that on rc1 once available and push out as the togreg branch of iio.git.
Thanks,
Jonathan
Quoted 24 lines
Quoted 23 lines
Fixes 6f3d8de8886d ("iio: imu: smi330: Add driver")Signed-off-by Massimiliano Pellizzer <[email protected]>---
drivers/iio/imu/smi330/smi330_core.c| 1 -1 file changed, 1 deletion(-)drivers/iio/imu/smi330/smi330_core.c +0
-2@@ -475,7 +475,6 @@ static int smi330_read_avail(struct iio_dev *indio_dev, *vals = smi330_average_attr.vals; *length = smi330_average_attr.len; *type = smi330_average_attr.type; - *type =IIO_VAL_INT ;return IIO_AVAIL_LIST ;case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : *vals = smi330_bandwidth_attr.vals; --2.52.0