aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ezx-pcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/ezx-pcap.c')
-rw-r--r--drivers/mfd/ezx-pcap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 134c69aa4790..c2b698d69a93 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -384,12 +384,20 @@ static int __devinit pcap_add_subdev(struct pcap_chip *pcap,
384 struct pcap_subdev *subdev) 384 struct pcap_subdev *subdev)
385{ 385{
386 struct platform_device *pdev; 386 struct platform_device *pdev;
387 int ret;
387 388
388 pdev = platform_device_alloc(subdev->name, subdev->id); 389 pdev = platform_device_alloc(subdev->name, subdev->id);
390 if (!pdev)
391 return -ENOMEM;
392
389 pdev->dev.parent = &pcap->spi->dev; 393 pdev->dev.parent = &pcap->spi->dev;
390 pdev->dev.platform_data = subdev->platform_data; 394 pdev->dev.platform_data = subdev->platform_data;
391 395
392 return platform_device_add(pdev); 396 ret = platform_device_add(pdev);
397 if (ret)
398 platform_device_put(pdev);
399
400 return ret;
393} 401}
394 402
395static int __devexit ezx_pcap_remove(struct spi_device *spi) 403static int __devexit ezx_pcap_remove(struct spi_device *spi)
@@ -457,6 +465,7 @@ static int __devinit ezx_pcap_probe(struct spi_device *spi)
457 pcap->irq_base = pdata->irq_base; 465 pcap->irq_base = pdata->irq_base;
458 pcap->workqueue = create_singlethread_workqueue("pcapd"); 466 pcap->workqueue = create_singlethread_workqueue("pcapd");
459 if (!pcap->workqueue) { 467 if (!pcap->workqueue) {
468 ret = -ENOMEM;
460 dev_err(&spi->dev, "cant create pcap thread\n"); 469 dev_err(&spi->dev, "cant create pcap thread\n");
461 goto free_pcap; 470 goto free_pcap;
462 } 471 }