Skip to content

Commit 3a5f80b

Browse files
dlechjic23
authored andcommitted
iio: light: ltr501: 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-19-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent f0ba492 commit 3a5f80b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/iio/light/ltr501.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,14 +1279,12 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
12791279
struct {
12801280
u16 channels[3];
12811281
aligned_s64 ts;
1282-
} scan;
1282+
} scan = { };
12831283
__le16 als_buf[2];
12841284
u8 mask = 0;
12851285
int j = 0;
12861286
int ret, psdata;
12871287

1288-
memset(&scan, 0, sizeof(scan));
1289-
12901288
/* figure out which data needs to be ready */
12911289
if (test_bit(0, indio_dev->active_scan_mask) ||
12921290
test_bit(1, indio_dev->active_scan_mask))

0 commit comments

Comments
 (0)