summary refs log tree commit diff
path: root/drivers/hwmon/nct6683.c
diff options
context:
space:
mode:
authorZeng Heng <zengheng4@huawei.com>2022-09-27 19:43:52 +0800
committerGuenter Roeck <linux@roeck-us.net>2022-10-02 08:01:18 -0700
commit1e4aa3e18dac1ef3a07a9d0e2662208644bd93de (patch)
treeb389e9b01d1bcf654a996fe48a3f8c4c4d07b9cd /drivers/hwmon/nct6683.c
parent760bda91cb4f5f778a6193b20c22726209579164 (diff)
downloadlinux-1e4aa3e18dac1ef3a07a9d0e2662208644bd93de.tar.gz
hwmon: (nct6683) remove unused variable in nct6683_create_attr_group
When enable 'unused-but-set-variable' compile
warning option, it would raise warning as below:

drivers/hwmon/nct6683.c:415:9:
warning: variable 'j' set but not used [-Wunused-but-set-variable]

Variable 'j' in nct6683_create_attr_group is unused,
so remove it and simplify the 'for' loop.

Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Link: https://lore.kernel.org/r/20220927114352.2498079-1-zengheng4@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/nct6683.c')
-rw-r--r--drivers/hwmon/nct6683.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index 6a9f420e7d32..a872f783e9cc 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -412,7 +412,7 @@ nct6683_create_attr_group(struct device *dev,
 	struct sensor_device_attr_u *su;
 	struct attribute_group *group;
 	struct attribute **attrs;
-	int i, j, count;
+	int i, count;
 
 	if (repeat <= 0)
 		return ERR_PTR(-EINVAL);
@@ -443,7 +443,7 @@ nct6683_create_attr_group(struct device *dev,
 
 	for (i = 0; i < repeat; i++) {
 		t = tg->templates;
-		for (j = 0; *t != NULL; j++) {
+		while (*t) {
 			snprintf(su->name, sizeof(su->name),
 				 (*t)->dev_attr.attr.name, tg->base + i);
 			if ((*t)->s2) {