Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH 0/7] hwmon: zero-initialization instead of memset
@ 2026-05-30 22:13 Manish Baing
  2026-05-30 22:13 ` [PATCH 1/7] hwmon: drivetemp: Use zero-initialization instead of memset() Manish Baing
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Manish Baing @ 2026-05-30 22:13 UTC (permalink / raw)
  To: linux, jdelvare, nuno.sa
  Cc: abdurrahman, bartosz.golaszewski, linusw, linux-hwmon,
	linux-kernel, skhan, me, manishbaing2789

Hi all,

This patch series cleans up memory initialization across several
hardware monitoring (hwmon) drivers by replacing explicit memset() calls
with empty brace initialization (= {}).

Following similar cleanups in the IIO subsystem [1], this series updates 
these drivers to stop using memset() for stack memory initialization.
As noted in those discussions [2], using empty brace initialization (= {})
is the preferred approach. 

Beyond simple replacements, a few drivers (nct6683, nct6775-platform, it87)
were using memset() inside a for-loop. To fix this, the variable 
declarationwas moved directly inside the loop and zero-initialized there. 
This safely resets the data on every iteration and makes the code much 
cleaner.

Testing:
- Compiled all modified files using `make W=1` with no warnings or errors. 

[1]: https://lore.kernel.org/all/20250611-iio-zero-init-stack-with-instead-of-memset-v1-0-ebb2d0a24302@baylibre.com/
[2]: https://lore.kernel.org/linux-iio/202505090942.48EBF01B@keescook/

Manish Baing (7):
  hwmon: drivetemp: Use zero-initialization instead of memset()
  hwmon: f71882fg: Use zero-initialization instead of memset()
  hwmon: ltc2947-core: Use zero-initialization instead of memset()
  hwmon: nct6683: Use zero-initialization instead of memset()
  hwmon: nct6775-platform: Use zero-initialization instead of memset()
  hwmon: pmbus: adm1266: Use zero-initialization instead of memset()
  hwmon: it87: Use zero-initialization instead of memset()

 drivers/hwmon/drivetemp.c        | 3 +--
 drivers/hwmon/f71882fg.c         | 4 +---
 drivers/hwmon/it87.c             | 3 +--
 drivers/hwmon/ltc2947-core.c     | 4 +---
 drivers/hwmon/nct6683.c          | 4 ++--
 drivers/hwmon/nct6775-platform.c | 4 ++--
 drivers/hwmon/pmbus/adm1266.c    | 4 +---
 7 files changed, 9 insertions(+), 17 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-05-30 22:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-30 22:13 [PATCH 0/7] hwmon: zero-initialization instead of memset Manish Baing
2026-05-30 22:13 ` [PATCH 1/7] hwmon: drivetemp: Use zero-initialization instead of memset() Manish Baing
2026-05-30 22:17   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 2/7] hwmon: f71882fg: " Manish Baing
2026-05-30 22:18   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 3/7] hwmon: ltc2947-core: " Manish Baing
2026-05-30 22:32   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 4/7] hwmon: nct6683: " Manish Baing
2026-05-30 22:35   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 5/7] hwmon: nct6775-platform: " Manish Baing
2026-05-30 22:37   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 6/7] hwmon: pmbus: adm1266: " Manish Baing
2026-05-30 22:40   ` sashiko-bot
2026-05-30 22:13 ` [PATCH 7/7] hwmon: it87: " Manish Baing
2026-05-30 22:47   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox