diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-02-12 20:31:31 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-13 07:52:19 -0500 |
commit | e81d7bc89c9623ea000890fb4cdf7e731dc21f71 (patch) | |
tree | ef2822bf7b852b1411efc72e64a3c4cf2789683e /drivers/regulator | |
parent | cbb0ed495ca165a94d66610adf64961f2117ec36 (diff) |
regulator: s5m8767: Prevent possible NULL pointer dereference
s5m8767_pmic_dt_parse_pdata dereferenes pdata, thus check pdata earlier to
avoid NULL pointer dereference.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/s5m8767.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index ef0532d56d43..8a831947c351 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -659,17 +659,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
659 | struct s5m8767_info *s5m8767; | 659 | struct s5m8767_info *s5m8767; |
660 | int i, ret, size, buck_init; | 660 | int i, ret, size, buck_init; |
661 | 661 | ||
662 | if (!pdata) { | ||
663 | dev_err(pdev->dev.parent, "Platform data not supplied\n"); | ||
664 | return -ENODEV; | ||
665 | } | ||
666 | |||
662 | if (iodev->dev->of_node) { | 667 | if (iodev->dev->of_node) { |
663 | ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata); | 668 | ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata); |
664 | if (ret) | 669 | if (ret) |
665 | return ret; | 670 | return ret; |
666 | } | 671 | } |
667 | 672 | ||
668 | if (!pdata) { | ||
669 | dev_err(pdev->dev.parent, "Platform data not supplied\n"); | ||
670 | return -ENODEV; | ||
671 | } | ||
672 | |||
673 | if (pdata->buck2_gpiodvs) { | 673 | if (pdata->buck2_gpiodvs) { |
674 | if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) { | 674 | if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) { |
675 | dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); | 675 | dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); |