Skip to content

Commit f0ba492

Browse files
dlechjic23
authored andcommitted
iio: light: bh1745: 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-18-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 8cc5e9b commit f0ba492

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/iio/light/bh1745.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,12 @@ static irqreturn_t bh1745_trigger_handler(int interrupt, void *p)
740740
struct {
741741
u16 chans[4];
742742
aligned_s64 timestamp;
743-
} scan;
743+
} scan = { };
744744
u16 value;
745745
int ret;
746746
int i;
747747
int j = 0;
748748

749-
memset(&scan, 0, sizeof(scan));
750-
751749
iio_for_each_active_channel(indio_dev, i) {
752750
ret = regmap_bulk_read(data->regmap, BH1745_RED_LSB + 2 * i,
753751
&value, 2);

0 commit comments

Comments
 (0)