public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: imu: smi330: remove redundant assignment in smi330_read_avail
@ 2025-11-25 17:18 Massimiliano Pellizzer
  2025-11-26  9:56 ` AW: " Shen Jianping (ME-SE/EAD2)
  0 siblings, 1 reply; 3+ messages in thread
From: Massimiliano Pellizzer @ 2025-11-25 17:18 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy, Jianping.Shen
  Cc: linux-iio, linux-kernel, Massimiliano Pellizzer

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")
Signed-off-by: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
---
 drivers/iio/imu/smi330/smi330_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
index 7564f12543e0..0cf673b44b62 100644
--- a/drivers/iio/imu/smi330/smi330_core.c
+++ b/drivers/iio/imu/smi330/smi330_core.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* AW: [PATCH] iio: imu: smi330: remove redundant assignment in smi330_read_avail
  2025-11-25 17:18 [PATCH] iio: imu: smi330: remove redundant assignment in smi330_read_avail Massimiliano Pellizzer
@ 2025-11-26  9:56 ` Shen Jianping (ME-SE/EAD2)
  2025-12-07 18:26   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Shen Jianping (ME-SE/EAD2) @ 2025-11-26  9:56 UTC (permalink / raw)
  To: Massimiliano Pellizzer, jic23@kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org
  Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org

>Von: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
>Gesendet: Dienstag, 25. November 2025 18:18
>An: jic23@kernel.org; dlechner@baylibre.com; nuno.sa@analog.com;
>andy@kernel.org; Shen Jianping (ME-SE/EAD2) <Jianping.Shen@de.bosch.com>
>Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; Massimiliano Pellizzer
><mpellizzer.dev@gmail.com>
>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.
>
>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 <Jianping.Shen@de.bosch.com>

>
>Fixes: 6f3d8de8886d ("iio: imu: smi330: Add driver")
>Signed-off-by: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
>---
> drivers/iio/imu/smi330/smi330_core.c | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/drivers/iio/imu/smi330/smi330_core.c
>b/drivers/iio/imu/smi330/smi330_core.c
>index 7564f12543e0..0cf673b44b62 100644
>--- a/drivers/iio/imu/smi330/smi330_core.c
>+++ b/drivers/iio/imu/smi330/smi330_core.c
>@@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: imu: smi330: remove redundant assignment in smi330_read_avail
  2025-11-26  9:56 ` AW: " Shen Jianping (ME-SE/EAD2)
@ 2025-12-07 18:26   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-12-07 18:26 UTC (permalink / raw)
  To: Shen Jianping (ME-SE/EAD2)
  Cc: Massimiliano Pellizzer, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Wed, 26 Nov 2025 09:56:23 +0000
"Shen Jianping (ME-SE/EAD2)" <Jianping.Shen@de.bosch.com> wrote:

> >Von: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
> >Gesendet: Dienstag, 25. November 2025 18:18
> >An: jic23@kernel.org; dlechner@baylibre.com; nuno.sa@analog.com;
> >andy@kernel.org; Shen Jianping (ME-SE/EAD2) <Jianping.Shen@de.bosch.com>
> >Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; Massimiliano Pellizzer
> ><mpellizzer.dev@gmail.com>
> >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.
> >
> >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 <Jianping.Shen@de.bosch.com>
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

> 
> >
> >Fixes: 6f3d8de8886d ("iio: imu: smi330: Add driver")
> >Signed-off-by: Massimiliano Pellizzer <mpellizzer.dev@gmail.com>
> >---
> > drivers/iio/imu/smi330/smi330_core.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> >diff --git a/drivers/iio/imu/smi330/smi330_core.c
> >b/drivers/iio/imu/smi330/smi330_core.c
> >index 7564f12543e0..0cf673b44b62 100644
> >--- a/drivers/iio/imu/smi330/smi330_core.c
> >+++ b/drivers/iio/imu/smi330/smi330_core.c
> >@@ -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  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-07 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 17:18 [PATCH] iio: imu: smi330: remove redundant assignment in smi330_read_avail Massimiliano Pellizzer
2025-11-26  9:56 ` AW: " Shen Jianping (ME-SE/EAD2)
2025-12-07 18:26   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox