Skip to content

Commit 40fae6d

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

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/iio/pressure/mprls0025pa_i2c.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ static int mpr_i2c_write(struct mpr_data *data, const u8 cmd, const u8 unused)
4444
{
4545
int ret;
4646
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 };
5148

5249
ret = i2c_master_send(client, wdata, MPR_PKT_SYNC_LEN);
5350
if (ret < 0)

0 commit comments

Comments
 (0)