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: mprls0025pa: use = { } instead of memset()

Use { } instead of memset() to zero-initialize stack memory to simplify
the code.

The initialize of the cmd value is trivial so it can be moved to the
array initializer as well.

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

authored by

David Lechner and committed by
Jonathan Cameron
73f31d9f b2dead59

+1 -4
+1 -4
drivers/iio/pressure/mprls0025pa_i2c.c
··· 44 44 { 45 45 int ret; 46 46 struct i2c_client *client = to_i2c_client(data->dev); 47 - u8 wdata[MPR_PKT_SYNC_LEN]; 48 - 49 - memset(wdata, 0, sizeof(wdata)); 50 - wdata[0] = cmd; 47 + u8 wdata[MPR_PKT_SYNC_LEN] = { cmd }; 51 48 52 49 ret = i2c_master_send(client, wdata, MPR_PKT_SYNC_LEN); 53 50 if (ret < 0)