From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.s-osg.org (lists.s-osg.org. [54.187.51.154]) by gmr-mx.google.com with ESMTP id r2si625868pfr.0.2016.01.22.03.43.32 for ; Fri, 22 Jan 2016 03:43:32 -0800 (PST) Subject: [rtc-linux] Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length To: Laxman Dewangan , linux-kernel@vger.kernel.org References: <1453407813-14646-1-git-send-email-javier@osg.samsung.com> <1453407813-14646-3-git-send-email-javier@osg.samsung.com> <56A1F8BB.9090803@nvidia.com> Cc: Kukjin Kim , rtc-linux@googlegroups.com, Chanwoo Choi , Alexandre Belloni , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org From: Javier Martinez Canillas Message-ID: <56A215DD.5030904@osg.samsung.com> Date: Fri, 22 Jan 2016 08:43:25 -0300 MIME-Version: 1.0 In-Reply-To: <56A1F8BB.9090803@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hello Laxman, Thanks a lot for your feedback and acks. On 01/22/2016 06:39 AM, Laxman Dewangan wrote: > > On Friday 22 January 2016 01:53 AM, Javier Martinez Canillas wrote: >> 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 >> Reviewed-by: Krzysztof Kozlowski >> >> > Acked-by: Laxman Dewangan > > > Similar stuffs are there on multiple places: > u8 data[RTC_NR_TIME]; > > ::: > ret = regmap_bulk_read(info->max77686->rtc_regmap, > MAX77686_ALARM1_SEC, data, RTC_NR_TIME); > > > Should we say: > ret = regmap_bulk_read(info->max77686->rtc_regmap, > MAX77686_ALARM1_SEC, data, ARRAY_SIZE(data)); > Very good point, I'll change those on this patch as well for v3. Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Javier Martinez Canillas Subject: Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length Date: Fri, 22 Jan 2016 08:43:25 -0300 Message-ID: <56A215DD.5030904@osg.samsung.com> References: <1453407813-14646-1-git-send-email-javier@osg.samsung.com> <1453407813-14646-3-git-send-email-javier@osg.samsung.com> <56A1F8BB.9090803@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from lists.s-osg.org ([54.187.51.154]:37636 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbcAVLnh (ORCPT ); Fri, 22 Jan 2016 06:43:37 -0500 In-Reply-To: <56A1F8BB.9090803@nvidia.com> Sender: linux-samsung-soc-owner@vger.kernel.org List-Id: linux-samsung-soc@vger.kernel.org To: Laxman Dewangan , linux-kernel@vger.kernel.org Cc: Kukjin Kim , rtc-linux@googlegroups.com, Chanwoo Choi , Alexandre Belloni , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org Hello Laxman, Thanks a lot for your feedback and acks. On 01/22/2016 06:39 AM, Laxman Dewangan wrote: > > On Friday 22 January 2016 01:53 AM, Javier Martinez Canillas wrote: >> 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 >> Reviewed-by: Krzysztof Kozlowski >> >> > Acked-by: Laxman Dewangan > > > Similar stuffs are there on multiple places: > u8 data[RTC_NR_TIME]; > > ::: > ret = regmap_bulk_read(info->max77686->rtc_regmap, > MAX77686_ALARM1_SEC, data, RTC_NR_TIME); > > > Should we say: > ret = regmap_bulk_read(info->max77686->rtc_regmap, > MAX77686_ALARM1_SEC, data, ARRAY_SIZE(data)); > Very good point, I'll change those on this patch as well for v3. Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America