[PATCH 5/7] hwmon: nct6775-platform: Use zero-initialization instead of memset()
From: Manish Baing
Date: Sat May 30 2026 - 18:16:19 EST
Reduce the scope of 'struct resource res' 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 explicit memset() call.
No functional change.
Signed-off-by: Manish Baing <manishbaing2789@xxxxxxxxx>
---
drivers/hwmon/nct6775-platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c
index 1975399ac440..b73086a56d97 100644
--- a/drivers/hwmon/nct6775-platform.c
+++ b/drivers/hwmon/nct6775-platform.c
@@ -1528,7 +1528,6 @@ static int __init sensors_nct6775_platform_init(void)
int i, err;
bool found = false;
int address;
- struct resource res;
struct nct6775_sio_data sio_data;
int sioaddr[2] = { 0x2e, 0x4e };
enum sensor_access access = access_direct;
@@ -1562,6 +1561,8 @@ static int __init sensors_nct6775_platform_init(void)
* nct6775 hardware monitor, and call probe()
*/
for (i = 0; i < ARRAY_SIZE(pdev); i++) {
+ struct resource res = { };
+
sio_data.sio_outb = superio_outb;
sio_data.sio_inb = superio_inb;
sio_data.sio_select = superio_select;
@@ -1596,7 +1597,6 @@ static int __init sensors_nct6775_platform_init(void)
goto exit_device_put;
if (sio_data.access == access_direct) {
- memset(&res, 0, sizeof(res));
res.name = DRVNAME;
res.start = address + IOREGION_OFFSET;
res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1;
--
2.43.0