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

index 1640aa3717eddc135dfac9d5e45d899ae2579f64..6eef37c0952d7c209478911413de2cf3d2552920 100644 (file)
@@ -583,11 +583,9 @@ static int zpa2326_fill_sample_buffer(struct iio_dev               *indio_dev,
                u32 pressure;
                u16 temperature;
                aligned_s64 timestamp;
-       }   sample;
+       } sample = { };
        int err;
 
-       memset(&sample, 0, sizeof(sample));
-
        if (test_bit(0, indio_dev->active_scan_mask)) {
                /* Get current pressure from hardware FIFO. */
                err = zpa2326_dequeue_pressure(indio_dev, &sample.pressure);