Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

David Lechner and committed by
Jonathan Cameron
acddd609 19ae7344

+1 -3
+1 -3
drivers/iio/light/opt4060.c
··· 1083 1083 struct { 1084 1084 u32 chan[OPT4060_NUM_CHANS]; 1085 1085 aligned_s64 ts; 1086 - } raw; 1086 + } raw = { }; 1087 1087 int i = 0; 1088 1088 int chan, ret; 1089 1089 1090 1090 /* If the trigger is not from this driver, a new sample is needed.*/ 1091 1091 if (iio_trigger_validate_own_device(idev->trig, idev)) 1092 1092 opt4060_trigger_new_samples(idev); 1093 - 1094 - memset(&raw, 0, sizeof(raw)); 1095 1093 1096 1094 iio_for_each_active_channel(idev, chan) { 1097 1095 if (chan == OPT4060_ILLUM)