Re: [PATCH v2 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length
From: Laxman Dewangan
Date: Fri Jan 22 2016 - 04:50:03 EST
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@xxxxxxxxxxxxxxx>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
Acked-by: Laxman Dewangan <ldewangan@xxxxxxxxxx>
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));