diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2012-07-13 19:43:32 +0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-07-16 17:55:41 +0400 |
commit | 18273c5b463d9f98ef81f1a6217a7f4168dd809a (patch) | |
tree | 81d735105c902a5f2220e8424c2993e4a98e3b5c | |
parent | ad95ad10b0881dd317d833dd37ba6706d704073a (diff) | |
download | linux-18273c5b463d9f98ef81f1a6217a7f4168dd809a.tar.xz |
mfd: Add missing out of memory check for pcf50633
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44561
Reported-by: <rucsoftsec@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/pcf50633-core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index 29c122bf28ea..45ce1fb5a549 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c @@ -253,8 +253,13 @@ static int __devinit pcf50633_probe(struct i2c_client *client, } pdev->dev.parent = pcf->dev; - platform_device_add_data(pdev, &pdata->reg_init_data[i], - sizeof(pdata->reg_init_data[i])); + if (platform_device_add_data(pdev, &pdata->reg_init_data[i], + sizeof(pdata->reg_init_data[i])) < 0) { + platform_device_put(pdev); + dev_err(pcf->dev, "Out of memory for regulator parameters %d\n", + i); + continue; + } pcf->regulator_pdev[i] = pdev; platform_device_add(pdev); |