]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: chemical: scd4x: use = { } instead of memset()
authorDavid Lechner <dlechner@baylibre.com>
Wed, 11 Jun 2025 22:39:04 +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-12-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/chemical/scd4x.c

index 2463149519b6d82caede9c9b253942fa421fdd3c..8859f89fb2a942d940b1ba7adf202977df7b4ad6 100644 (file)
@@ -665,10 +665,9 @@ static irqreturn_t scd4x_trigger_handler(int irq, void *p)
        struct {
                uint16_t data[3];
                aligned_s64 ts;
-       } scan;
+       } scan = { };
        int ret;
 
-       memset(&scan, 0, sizeof(scan));
        mutex_lock(&state->lock);
        ret = scd4x_read_poll(state, scan.data);
        mutex_unlock(&state->lock);