mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: linux-kernel@vger.kernel.org
Cc: Kukjin Kim <kgene@kernel.org>,
	rtc-linux@googlegroups.com, Chanwoo Choi <cw00.choi@samsung.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	linux-samsung-soc@vger.kernel.org,
	Javier Martinez Canillas <javier@osg.samsung.com>
Subject: [PATCH 1/8] rtc: max77686: Use ARRAY_SIZE() instead of current array length
Date: Wed, 20 Jan 2016 14:14:41 -0300	[thread overview]
Message-ID: <1453310088-29985-2-git-send-email-javier@osg.samsung.com> (raw)
In-Reply-To: <1453310088-29985-1-git-send-email-javier@osg.samsung.com>

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@osg.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

  reply	other threads:[~2016-01-20 17:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 17:14 [PATCH 0/8] rtc: max77686: Extend driver and add max77802 support Javier Martinez Canillas
2016-01-20 17:14 ` Javier Martinez Canillas [this message]
2016-01-21  0:35   ` [PATCH 1/8] rtc: max77686: Use ARRAY_SIZE() instead of current array length Krzysztof Kozlowski
2016-01-20 17:14 ` [PATCH 2/8] rtc: max77686: Use usleep_range() instead of msleep() Javier Martinez Canillas
2016-01-21  0:37   ` Krzysztof Kozlowski
2016-01-21 14:52     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 3/8] rtc: max77686: Use a driver data struct instead hard-coded values Javier Martinez Canillas
2016-01-21  0:45   ` Krzysztof Kozlowski
2016-01-21 14:55     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 4/8] rtc: max77686: Add an indirection level to access RTC registers Javier Martinez Canillas
2016-01-21  1:05   ` Krzysztof Kozlowski
2016-01-21 14:57     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 5/8] rtc: max77686: Add max77802 support Javier Martinez Canillas
2016-01-21  1:56   ` Krzysztof Kozlowski
2016-01-21 15:12     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 6/8] rtc: Remove Maxim 77802 driver Javier Martinez Canillas
2016-01-21  1:57   ` Krzysztof Kozlowski
2016-01-21 15:12     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 7/8] ARM: exynos_defconfig: Remove MAX77802 RTC Kconfig symbol Javier Martinez Canillas
2016-01-21  1:58   ` Krzysztof Kozlowski
2016-01-21 15:14     ` Javier Martinez Canillas
2016-01-20 17:14 ` [PATCH 8/8] ARM: multi_v7_defconfig: " Javier Martinez Canillas
2016-01-21  1:58   ` Krzysztof Kozlowski
2016-01-21  0:30 ` [PATCH 0/8] rtc: max77686: Extend driver and add max77802 support Alexandre Belloni
2016-01-21  0:34   ` Krzysztof Kozlowski
2016-01-21 14:50     ` Javier Martinez Canillas
2016-01-21  0:48 ` Krzysztof Kozlowski
2016-01-21 15:15   ` Javier Martinez Canillas

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=1453310088-29985-2-git-send-email-javier@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=cw00.choi@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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

Powered by JetHome