From: Manish Baing <manishbaing2789@gmail.com>
To: linux@roeck-us.net, jdelvare@suse.com, nuno.sa@analog.com
Cc: abdurrahman@nexthop.ai, bartosz.golaszewski@oss.qualcomm.com,
linusw@kernel.org, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
me@brighamcampbell.com, manishbaing2789@gmail.com
Subject: [PATCH 5/7] hwmon: nct6775-platform: Use zero-initialization instead of memset()
Date: Sat, 30 May 2026 22:13:50 +0000 [thread overview]
Message-ID: <20260530221353.159461-6-manishbaing2789@gmail.com> (raw)
In-Reply-To: <20260530221353.159461-1-manishbaing2789@gmail.com>
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@gmail.com>
---
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
next prev parent reply other threads:[~2026-05-30 22:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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:13 ` [PATCH 2/7] hwmon: f71882fg: " Manish Baing
2026-05-30 22:13 ` [PATCH 3/7] hwmon: ltc2947-core: " Manish Baing
2026-05-30 22:13 ` [PATCH 4/7] hwmon: nct6683: " Manish Baing
2026-05-30 22:13 ` Manish Baing [this message]
2026-05-30 22:13 ` [PATCH 6/7] hwmon: pmbus: adm1266: " Manish Baing
2026-05-30 22:13 ` [PATCH 7/7] hwmon: it87: " Manish Baing
2026-06-06 19:22 ` Manish Baing
2026-06-07 16:12 ` [PATCH 0/7] hwmon: zero-initialization instead of memset Guenter Roeck
2026-06-25 16:04 ` Manish Baing
2026-06-26 1:59 ` Guenter Roeck
2026-06-26 4:43 ` Manish Baing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260530221353.159461-6-manishbaing2789@gmail.com \
--to=manishbaing2789@gmail.com \
--cc=abdurrahman@nexthop.ai \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=jdelvare@suse.com \
--cc=linusw@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=me@brighamcampbell.com \
--cc=nuno.sa@analog.com \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®