Skip to contentSkip to conversation

iio: imu: smi330: remove redundant assignment in smi330_read_avail

PATCH In review Massimiliano Pellizzer 3 participants 3 messages Nov 25, 2025 – Dec 7, 2025 IIO

lore
Share & tools
lore
#0 lore raw

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.

Fixes 6f3d8de8886d ("iio: imu: smi330: Add driver")
---
 drivers/iio/imu/smi330/smi330_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/imu/smi330/smi330_core.c +0 -1
index 7564f12543e0..0cf673b44b62 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
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 in smi330_read_avail

Quoted 7 lines

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.

Looks good to me. Thank you.

Quoted 22 lines
Fixes 6f3d8de8886d ("iio: imu: smi330: Add driver")

---
drivers/iio/imu/smi330/smi330_core.c | 1 -

1 file changed, 1 deletion(-)
drivers/iio/imu/smi330/smi330_core.c +0 -2
index 7564f12543e0..0cf673b44b62 100644
@@ -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

maintainer
#2 lore raw
Quoted 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 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.

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.

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")

---
drivers/iio/imu/smi330/smi330_core.c | 1 -

1 file changed, 1 deletion(-)
drivers/iio/imu/smi330/smi330_core.c +0 -2
index 7564f12543e0..0cf673b44b62 100644
@@ -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