mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
iio: imu: inv_mpu6050: 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-17-ebb2d0a24302@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
352112e2d9
commit
3ee3c09d2d
|
|
@ -130,12 +130,10 @@ int inv_mpu_acpi_create_mux_client(struct i2c_client *client)
|
|||
|
||||
st->mux_client = NULL;
|
||||
if (adev) {
|
||||
struct i2c_board_info info;
|
||||
struct i2c_board_info info = { };
|
||||
struct i2c_client *mux_client;
|
||||
int ret = -1;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
dmi_check_system(inv_mpu_dev_list);
|
||||
switch (matched_product_name) {
|
||||
case INV_MPU_ASUS_T100TA:
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
|
|||
u16 fifo_count;
|
||||
u32 fifo_period;
|
||||
s64 timestamp;
|
||||
u8 data[INV_MPU6050_OUTPUT_DATA_SIZE] __aligned(8);
|
||||
/* clear internal data buffer for avoiding kernel data leak */
|
||||
u8 data[INV_MPU6050_OUTPUT_DATA_SIZE] __aligned(8) = { };
|
||||
size_t i, nb;
|
||||
|
||||
mutex_lock(&st->lock);
|
||||
|
|
@ -103,9 +104,6 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
|
|||
inv_sensors_timestamp_interrupt(&st->timestamp, 1, pf->timestamp);
|
||||
inv_sensors_timestamp_apply_odr(&st->timestamp, fifo_period, 1, 0);
|
||||
|
||||
/* clear internal data buffer for avoiding kernel data leak */
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
/* read all data once and process every samples */
|
||||
result = regmap_noinc_read(st->map, st->reg->fifo_r_w, st->data, fifo_count);
|
||||
if (result)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user