Skip to content

Commit 62c7683

Browse files
dlechjic23
authored andcommitted
iio: chemical: scd30: 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-13-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 622a8bb commit 62c7683

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/chemical/scd30_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,15 +587,14 @@ static irqreturn_t scd30_trigger_handler(int irq, void *p)
587587
struct {
588588
int data[SCD30_MEAS_COUNT];
589589
aligned_s64 ts;
590-
} scan;
590+
} scan = { };
591591
int ret;
592592

593593
mutex_lock(&state->lock);
594594
if (!iio_trigger_using_own(indio_dev))
595595
ret = scd30_read_poll(state);
596596
else
597597
ret = scd30_read_meas(state);
598-
memset(&scan, 0, sizeof(scan));
599598
memcpy(scan.data, state->meas, sizeof(state->meas));
600599
mutex_unlock(&state->lock);
601600
if (ret)

0 commit comments

Comments
 (0)