regulator: act8865: fix parsing of platform data
authorBeniamino Galvani <b.galvani@gmail.com>
Sun, 22 Jun 2014 15:31:41 +0000 (17:31 +0200)
committerMark Brown <broonie@linaro.org>
Tue, 5 Aug 2014 17:02:51 +0000 (18:02 +0100)
commit48a1e1b50d9e848fea9708795bd5d9aa97aa9c2a
tree1e7f865b19606feb362990b27414506bca58ca14
parent7171511eaec5bf23fb06078f59784a3a0626b38f
regulator: act8865: fix parsing of platform data

The driver loops through all available regulators (ACT8865_REG_NUM)
and accesses pdata->regulators[i].platform_data without checking the
actual value of num_regulators in platform data, potentially causing a
invalid memory access.

Fix this and look up the regulator init_data by id in platform data.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Tested-by Wenyou.Yang <wenyou.yang@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/act8865-regulator.c