Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314859

Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length

From Laxman Dewangan <ldewangan@nvidia.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length
Date 2016-01-22 11:00 +0100
Message-ID <qTGFA-2gp-17@gated-at.bofh.it> (permalink)
References <qTu1H-1V0-5@gated-at.bofh.it> <qTu1I-1V0-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <javier@osg.samsung.com>
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>
>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>


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));

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/10] rtc: max77686: Extend driver and add max77802 support Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
  [PATCH v2 01/10] rtc: max77686: Fix max77686_rtc_read_alarm() return value Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
    Re: [PATCH v2 01/10] rtc: max77686: Fix max77686_rtc_read_alarm()  return value Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-01-22 02:00 +0100
    Re: [PATCH v2 01/10] rtc: max77686: Fix max77686_rtc_read_alarm()  return value Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-22 10:50 +0100
  [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
    Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of  current array length Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-01-22 02:00 +0100
    Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current  array length Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-22 11:00 +0100
      Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of  current array length Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-22 12:50 +0100
  [PATCH v2 07/10] rtc: max77686: Use dev_warn() instead of pr_warn() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
  [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of msleep() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
    Re: [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of  msleep() Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-01-22 02:10 +0100
    Re: [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of  msleep() Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-22 11:00 +0100
      Re: [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of  msleep() Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-22 13:10 +0100
        Re: [PATCH v2 03/10] rtc: max77686: Use usleep_range() instead of  msleep() Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-25 12:30 +0100
  [PATCH v2 10/10] ARM: multi_v7_defconfig: Remove MAX77802 RTC Kconfig symbol Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
    Re: [PATCH v2 10/10] ARM: multi_v7_defconfig: Remove MAX77802 RTC  Kconfig symbol Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-22 11:10 +0100
      Re: [PATCH v2 10/10] ARM: multi_v7_defconfig: Remove MAX77802 RTC  Kconfig symbol Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-22 13:10 +0100
  [PATCH v2 09/10] ARM: exynos_defconfig: Remove MAX77802 RTC Kconfig symbol Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-21 21:30 +0100
  Re: [PATCH v2 00/10] rtc: max77686: Extend driver and add max77802  support Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-01-25 17:30 +0100
    Re: [PATCH v2 00/10] rtc: max77686: Extend driver and add max77802  support Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-26 00:50 +0100

csiph-web