Skip to content

Commit 622a8bb

Browse files
dlechjic23
authored andcommitted
iio: chemical: scd4x: use = { } instead of memset()
Use { } instead of memset() to zero-initialize stack memory to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-12-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 8008762 commit 622a8bb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/chemical/scd4x.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,9 @@ static irqreturn_t scd4x_trigger_handler(int irq, void *p)
665665
struct {
666666
uint16_t data[3];
667667
aligned_s64 ts;
668-
} scan;
668+
} scan = { };
669669
int ret;
670670

671-
memset(&scan, 0, sizeof(scan));
672671
mutex_lock(&state->lock);
673672
ret = scd4x_read_poll(state, scan.data);
674673
mutex_unlock(&state->lock);

0 commit comments

Comments
 (0)