regulator: s2mps11: Fix GPIO suspend enable shift wrapping bug
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Wed, 24 Jun 2015 10:48:43 +0000 (19:48 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 24 Jun 2015 11:25:20 +0000 (12:25 +0100)
commit32c848e33ace75fce388cceff76223d12b46eaa3
tree9d0ccbd87946c9ad8d62638156759d8392b20595
parent733ada000f2c9618ccbac7b9ba146113f0a6675b
regulator: s2mps11: Fix GPIO suspend enable shift wrapping bug

Status of enabling suspend mode for regulator was stored in bitmap-like
long integer.

However since adding support for S2MPU02 the number of regulators
exceeded 32 so on devices with more than 32 regulators (S2MPU02 and
S2MPS13) overflow happens when shifting the bit. This could lead to
enabling suspend mode for completely different regulator than intended
or to switching different regulator to other mode (e.g. from always
enabled to controlled by PWRHOLD pin). Both cases could result in larger
energy usage and issues when suspending to RAM.

Fixes: 00e2573d2c10 ("regulator: s2mps11: Add support S2MPU02 regulator device")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
drivers/regulator/s2mps11.c