[PATCH 4/7] hwmon: nct6683: Use zero-initialization instead of memset()
From: Manish Baing
Date: Sat May 30 2026 - 18:15:52 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/nct6683.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index 0581770380cc..bd30867f9e7c 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -1437,7 +1437,6 @@ static int __init sensors_nct6683_init(void)
{
struct nct6683_sio_data sio_data;
int sioaddr[2] = { 0x2e, 0x4e };
- struct resource res;
bool found = false;
int address;
int i, err;
@@ -1454,6 +1453,8 @@ static int __init sensors_nct6683_init(void)
* nct6683 hardware monitor, and call probe()
*/
for (i = 0; i < ARRAY_SIZE(pdev); i++) {
+ struct resource res = { };
+
address = nct6683_find(sioaddr[i], &sio_data);
if (address <= 0)
continue;
@@ -1471,7 +1472,6 @@ static int __init sensors_nct6683_init(void)
if (err)
goto exit_device_put;
- memset(&res, 0, sizeof(res));
res.name = DRVNAME;
res.start = address + IOREGION_OFFSET;
res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1;
--
2.43.0