From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753275AbcAVLnq (ORCPT ); Fri, 22 Jan 2016 06:43:46 -0500 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 Subject: 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56A1F8BB.9090803@nvidia.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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