]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: light: bh1745: use = { } instead of memset()
authorDavid Lechner <dlechner@baylibre.com>
Wed, 11 Jun 2025 22:39:10 +0000 (17:39 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 26 Jun 2025 18:32:56 +0000 (19:32 +0100)
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>
drivers/iio/light/bh1745.c

index 56ab5fe90ff9128035cf25948bba1589492e66e4..4e9bd8f831f7834dbcdbc5df4931f473d277d814 100644 (file)
@@ -740,14 +740,12 @@ static irqreturn_t bh1745_trigger_handler(int interrupt, void *p)
        struct {
                u16 chans[4];
                aligned_s64 timestamp;
-       } scan;
+       } scan = { };
        u16 value;
        int ret;
        int i;
        int j = 0;
 
-       memset(&scan, 0, sizeof(scan));
-
        iio_for_each_active_channel(indio_dev, i) {
                ret = regmap_bulk_read(data->regmap, BH1745_RED_LSB + 2 * i,
                                       &value, 2);