Skip to content

Commit a214ed8

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

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/iio/light/opt4060.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,16 +1083,14 @@ static irqreturn_t opt4060_trigger_handler(int irq, void *p)
10831083
struct {
10841084
u32 chan[OPT4060_NUM_CHANS];
10851085
aligned_s64 ts;
1086-
} raw;
1086+
} raw = { };
10871087
int i = 0;
10881088
int chan, ret;
10891089

10901090
/* If the trigger is not from this driver, a new sample is needed.*/
10911091
if (iio_trigger_validate_own_device(idev->trig, idev))
10921092
opt4060_trigger_new_samples(idev);
10931093

1094-
memset(&raw, 0, sizeof(raw));
1095-
10961094
iio_for_each_active_channel(idev, chan) {
10971095
if (chan == OPT4060_ILLUM)
10981096
ret = opt4060_calc_illuminance(chip, &raw.chan[i++]);

0 commit comments

Comments
 (0)