Re: [PATCH 7/7] hwmon: it87: Use zero-initialization instead of memset()
From: Manish Baing
Date: Sat Jun 06 2026 - 15:23:18 EST
Hi all,
The Sashiko AI bot flagged that replacing memset() with empty brace
initialization {} here might leave padding bytes uninitialized.
How would you prefer to proceed? Please let me know in case I need
to send a v2 to address this.
Sashiko AI review ·
https://sashiko.dev/#/patchset/20260530221353.159461-1-manishbaing2789@xxxxxxxxx?part=7
Thanks & Regards,
Manish
On Sun, May 31, 2026 at 3:44 AM Manish Baing <manishbaing2789@xxxxxxxxx> wrote:
>
> Reduce the scope of 'struct it87_sio_data sio_data' by moving it inside
> the for-loop and using empty brace initialization (= {}). This ensures
> the structure is safely zero-initialized on every iteration, allowing for
> the safe removal of the explicit memset() call.
>
> No functional change.
>
> Signed-off-by: Manish Baing <manishbaing2789@xxxxxxxxx>
> ---
> drivers/hwmon/it87.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index 5fd310662ee4..f3f8d835ff92 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -3777,7 +3777,6 @@ MODULE_DEVICE_TABLE(dmi, it87_dmi_table);
> static int __init sm_it87_init(void)
> {
> int sioaddr[2] = { REG_2E, REG_4E };
> - struct it87_sio_data sio_data;
> unsigned short isa_address[2];
> bool found = false;
> int i, err;
> @@ -3789,7 +3788,7 @@ static int __init sm_it87_init(void)
> dmi_check_system(it87_dmi_table);
>
> for (i = 0; i < ARRAY_SIZE(sioaddr); i++) {
> - memset(&sio_data, 0, sizeof(struct it87_sio_data));
> + struct it87_sio_data sio_data = { };
> isa_address[i] = 0;
> err = it87_find(sioaddr[i], &isa_address[i], &sio_data, i);
> if (err || isa_address[i] == 0)
> --
> 2.43.0
>