lkml.org 
[lkml]   [2016]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON
Date
On Thursday 18 February 2016 09:35:07 Krzysztof Kozlowski wrote:
> Following BUILD_BUG_ON using a variable fails for some of the compilers
> and optimization levels (reported for gcc 4.9):
> var = ARRAY_SIZE(s2mps15_regulators);
> BUILD_BUG_ON(S2MPS_REGULATOR_MAX < var);
> Fix this by using ARRAY_SIZE directly.
>
> Additionally add missing BUILD_BUG_ON check for S2MPS15 device (the
> check ensures that internal arrays are big enough to hold data for all
> of regulators on all devices).
>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

I've verified that this is the exact patch I have successfully tested
on locally and in Olof's autobuilder which reported the problem.

> case S2MPS15X:
> s2mps11->rdev_num = ARRAY_SIZE(s2mps15_regulators);
> regulators = s2mps15_regulators;
> + BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps15_regulators));
> break;
>

My version did not add this line, but it seems correct.

Tested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>

\
 
 \ /
  Last update: 2016-02-18 10:41    [W:0.075 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site