[PATCH] iio: light: as73211: remove duplicate zero init of scan.chan[3]

David Lechner posted 1 patch 3 weeks, 1 day ago
drivers/iio/light/as73211.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH] iio: light: as73211: remove duplicate zero init of scan.chan[3]
Posted by David Lechner 3 weeks, 1 day ago
Remove setting scan.chan[3] to zero. Since commit 433b99e92294 ("iio:
light: as73211: Ensure buffer holes are zeroed"), the entire scan struct
is zeroed before being filled with data, so this is redundant.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/light/as73211.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iio/light/as73211.c b/drivers/iio/light/as73211.c
index 32719f584c47..9fe830dac679 100644
--- a/drivers/iio/light/as73211.c
+++ b/drivers/iio/light/as73211.c
@@ -677,9 +677,6 @@ static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)
 				(char *)&scan.chan[0], 3 * sizeof(scan.chan[0]));
 		if (ret < 0)
 			goto done;
-
-		/* Avoid pushing uninitialized data */
-		scan.chan[3] = 0;
 	}
 
 	if (data_result) {

---
base-commit: ff0843ceb1fb11a6b73e0e77b932ef7967aecd4b
change-id: 20260315-iio-light-ad73211-remove-dup-zero-init-c2f35970c60c

Best regards,
--  
David Lechner <dlechner@baylibre.com>
Re: [PATCH] iio: light: as73211: remove duplicate zero init of scan.chan[3]
Posted by Andy Shevchenko 3 weeks ago
On Sun, Mar 15, 2026 at 02:21:51PM -0500, David Lechner wrote:
> Remove setting scan.chan[3] to zero. Since commit 433b99e92294 ("iio:
> light: as73211: Ensure buffer holes are zeroed"), the entire scan struct
> is zeroed before being filled with data, so this is redundant.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

...

> static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)

>  				(char *)&scan.chan[0], 3 * sizeof(scan.chan[0]));

Side note: the above looks like a room to improve.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] iio: light: as73211: remove duplicate zero init of scan.chan[3]
Posted by Jonathan Cameron 2 weeks, 2 days ago
On Mon, 16 Mar 2026 15:52:22 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Sun, Mar 15, 2026 at 02:21:51PM -0500, David Lechner wrote:
> > Remove setting scan.chan[3] to zero. Since commit 433b99e92294 ("iio:
> > light: as73211: Ensure buffer holes are zeroed"), the entire scan struct
> > is zeroed before being filled with data, so this is redundant.  
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> 
> ...
> 
> > static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)  
> 
> >  				(char *)&scan.chan[0], 3 * sizeof(scan.chan[0]));  
> 
> Side note: the above looks like a room to improve.
> 

Applied. Indeed that's an ugly line! 

Thanks,

Jonathan