[patch] hwmon: using wrong ARRAY_SIZE() limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We cleaned up this code to use ARRAY_SIZE() instead of just the number
4.  The problem is that data->reg_temp[] has 5 elements and we actually
wanted ARRAY_SIZE(data->temp) which has 4 elements.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index f0941d7..52b6a92 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1451,7 +1451,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev)
 		for (i = 0; i < NUM_TEMP; i++) {
 			if (!(data->have_temp & (1 << i)))
 				continue;
-			for (j = 0; j < ARRAY_SIZE(data->reg_temp); j++) {
+			for (j = 0; j < ARRAY_SIZE(data->temp); j++) {
 				if (data->reg_temp[j][i])
 					data->temp[j][i]
 					  = nct6775_read_temp(data,
@@ -3974,7 +3974,7 @@ static int nct6775_resume(struct device *dev)
 		if (!(data->have_temp & (1 << i)))
 			continue;
 
-		for (j = 1; j < ARRAY_SIZE(data->reg_temp); j++)
+		for (j = 1; j < ARRAY_SIZE(data->temp); j++)
 			if (data->reg_temp[j][i])
 				nct6775_write_temp(data, data->reg_temp[j][i],
 						   data->temp[j][i]);
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux