Re: [PATCH v2] regulator: s2mps11: Simplify expression used in BUILD_BUG_ON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Krzysztof,

> 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@xxxxxxxx>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
> 

[...]

>  	case S2MPS11X:
>  		s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);

Why don't we remove rdev_num at all? It's not used that much
other than in the probe function.

>  		regulators = s2mps11_regulators;
> -		BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num);
> +		BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mps11_regulators));
>  		break;

Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux