Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: pressure: mpl3115: 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-24-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
b2dead59 9e664cdd

+1 -2
+1 -2
drivers/iio/pressure/mpl3115.c
··· 160 160 * of the buffer may be either 16 or 32-bits. As such we cannot 161 161 * use a simple structure definition to express this data layout. 162 162 */ 163 - u8 buffer[16] __aligned(8); 163 + u8 buffer[16] __aligned(8) = { }; 164 164 int ret, pos = 0; 165 165 166 166 mutex_lock(&data->lock); ··· 170 170 goto done; 171 171 } 172 172 173 - memset(buffer, 0, sizeof(buffer)); 174 173 if (test_bit(0, indio_dev->active_scan_mask)) { 175 174 ret = i2c_smbus_read_i2c_block_data(data->client, 176 175 MPL3115_OUT_PRESS, 3, &buffer[pos]);