Skip to content

Commit f655a96

Browse files
dlechjic23
authored andcommitted
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>
1 parent d098904 commit f655a96

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/pressure/mpl3115.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p)
160160
* of the buffer may be either 16 or 32-bits. As such we cannot
161161
* use a simple structure definition to express this data layout.
162162
*/
163-
u8 buffer[16] __aligned(8);
163+
u8 buffer[16] __aligned(8) = { };
164164
int ret, pos = 0;
165165

166166
mutex_lock(&data->lock);
@@ -170,7 +170,6 @@ static irqreturn_t mpl3115_trigger_handler(int irq, void *p)
170170
goto done;
171171
}
172172

173-
memset(buffer, 0, sizeof(buffer));
174173
if (test_bit(0, indio_dev->active_scan_mask)) {
175174
ret = i2c_smbus_read_i2c_block_data(data->client,
176175
MPL3115_OUT_PRESS, 3, &buffer[pos]);

0 commit comments

Comments
 (0)