[PATCH 10/28] iio: adc: ti-lmp92064: use = { } instead of memset()

David Lechner posted 28 patches 4 months ago
[PATCH 10/28] iio: adc: ti-lmp92064: use = { } instead of memset()
Posted by David Lechner 4 months ago
Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ti-lmp92064.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ti-lmp92064.c b/drivers/iio/adc/ti-lmp92064.c
index 3f375c1f586c4153caf9b47c34a0dcf6d5c48266..7e57006a8a1268cdda3a31d7c0366f72e1b11ea7 100644
--- a/drivers/iio/adc/ti-lmp92064.c
+++ b/drivers/iio/adc/ti-lmp92064.c
@@ -200,11 +200,9 @@ static irqreturn_t lmp92064_trigger_handler(int irq, void *p)
 	struct {
 		u16 values[2];
 		aligned_s64 timestamp;
-	} data;
+	} data = { };
 	int ret;
 
-	memset(&data, 0, sizeof(data));
-
 	ret = lmp92064_read_meas(priv, data.values);
 	if (ret)
 		goto err;

-- 
2.43.0
Re: [PATCH 10/28] iio: adc: ti-lmp92064: use = { } instead of memset()
Posted by Leonard Göhrs 4 months ago

Am 12.06.25 um 00:39 schrieb David Lechner:
> Use { } instead of memset() to zero-initialize stack memory to simplify
> the code.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Leonard Göhrs <l.goehrs@pengutronix.de>