aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-08-24 01:47:22 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-28 18:28:59 -0400
commit929980ab1b90b5a5c93db9b9b7d58cc6e93049c8 (patch)
tree99eeed3baf78f5ec197efa124ab0df82a4ae70d6 /drivers/mfd
parent09ff21e0f670a71ea43765cedaab9246fd81540e (diff)
mfd: Fix tps6586x_add_subdevs error path
1. return -ENOMEM if platform_device_alloc() fail. 2. call platform_device_put() if platform_device_add() fail. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/tps6586x.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bc6587194de9..2f9336c3710c 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -273,13 +273,19 @@ static int __devinit tps6586x_add_subdevs(struct tps6586x *tps6586x,
273 subdev = &pdata->subdevs[i]; 273 subdev = &pdata->subdevs[i];
274 274
275 pdev = platform_device_alloc(subdev->name, subdev->id); 275 pdev = platform_device_alloc(subdev->name, subdev->id);
276 if (!pdev) {
277 ret = -ENOMEM;
278 goto failed;
279 }
276 280
277 pdev->dev.parent = tps6586x->dev; 281 pdev->dev.parent = tps6586x->dev;
278 pdev->dev.platform_data = subdev->platform_data; 282 pdev->dev.platform_data = subdev->platform_data;
279 283
280 ret = platform_device_add(pdev); 284 ret = platform_device_add(pdev);
281 if (ret) 285 if (ret) {
286 platform_device_put(pdev);
282 goto failed; 287 goto failed;
288 }
283 } 289 }
284 return 0; 290 return 0;
285 291