[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453310088-29985-2-git-send-email-javier@osg.samsung.com>
Date: Wed, 20 Jan 2016 14:14:41 -0300
From: Javier Martinez Canillas <javier@....samsung.com>
To: linux-kernel@...r.kernel.org
Cc: Kukjin Kim <kgene@...nel.org>, rtc-linux@...glegroups.com,
Chanwoo Choi <cw00.choi@...sung.com>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
Laxman Dewangan <ldewangan@...dia.com>,
linux-samsung-soc@...r.kernel.org,
Javier Martinez Canillas <javier@....samsung.com>
Subject: [PATCH 1/8] rtc: max77686: Use ARRAY_SIZE() instead of current array length
It is better to use the ARRAY_SIZE() macro instead of the array length
to avoid bugs if the array is later changed and the length not updated.
Signed-off-by: Javier Martinez Canillas <javier@....samsung.com>
---
drivers/rtc/rtc-max77686.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 7184a0eda793..9599be257db4 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -406,7 +406,8 @@ static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
info->rtc_24hr_mode = 1;
- ret = regmap_bulk_write(info->max77686->rtc_regmap, MAX77686_RTC_CONTROLM, data, 2);
+ ret = regmap_bulk_write(info->max77686->rtc_regmap,
+ MAX77686_RTC_CONTROLM, data, ARRAY_SIZE(data));
if (ret < 0) {
dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
__func__, ret);
--
2.5.0
Powered by blists - more mailing lists