Skip to content

Commit 7d0a746

Browse files
dlechjic23
authored andcommitted
iio: magnetometer: af8133j: 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-22-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 71f1305 commit 7d0a746

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/iio/magnetometer/af8133j.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,9 @@ static irqreturn_t af8133j_trigger_handler(int irq, void *p)
361361
struct {
362362
__le16 values[3];
363363
aligned_s64 timestamp;
364-
} sample;
364+
} sample = { };
365365
int ret;
366366

367-
memset(&sample, 0, sizeof(sample));
368-
369367
ret = af8133j_read_measurement(data, sample.values);
370368
if (ret)
371369
goto out_done;

0 commit comments

Comments
 (0)