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

index 57523f893a7242791e1cc964849c84654da349aa..debf57a52d1c0924660fe9538b8f704ac9facb59 100644 (file)
@@ -1279,14 +1279,12 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
        struct {
                u16 channels[3];
                aligned_s64 ts;
-       } scan;
+       } scan = { };
        __le16 als_buf[2];
        u8 mask = 0;
        int j = 0;
        int ret, psdata;
 
-       memset(&scan, 0, sizeof(scan));
-
        /* figure out which data needs to be ready */
        if (test_bit(0, indio_dev->active_scan_mask) ||
            test_bit(1, indio_dev->active_scan_mask))