aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/pcf50633-charger.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2009-10-13 18:12:33 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2009-12-13 13:21:17 -0500
commit68d641efd86d901d000b888eeab5481257d49f12 (patch)
treea916769e71d50c0d20725cad60fb0402da198692 /drivers/power/pcf50633-charger.c
parentb18fdc4b3e5e418e5582f5403c8a05b2c67eea16 (diff)
mfd: Fix memleak in pcf50633_client_dev_register
Since platform_device_add_data copies the passed data, the allocated subdev_pdata is never freed. A simple fix would be to either free subdev_pdata or put it onto the stack. But since the pcf50633 child devices can rely on beeing children of the pcf50633 core device it's much more elegant to get access to pcf50633 core structure through that link. This allows to get completly rid of pcf5033_subdev_pdata. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/power/pcf50633-charger.c')
-rw-r--r--drivers/power/pcf50633-charger.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index e8b278f7178..6a84a8eb8d7 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -303,7 +303,6 @@ static const u8 mbc_irq_handlers[] = {
303static int __devinit pcf50633_mbc_probe(struct platform_device *pdev) 303static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
304{ 304{
305 struct pcf50633_mbc *mbc; 305 struct pcf50633_mbc *mbc;
306 struct pcf50633_subdev_pdata *pdata = pdev->dev.platform_data;
307 int ret; 306 int ret;
308 int i; 307 int i;
309 u8 mbcs1; 308 u8 mbcs1;
@@ -313,7 +312,7 @@ static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
313 return -ENOMEM; 312 return -ENOMEM;
314 313
315 platform_set_drvdata(pdev, mbc); 314 platform_set_drvdata(pdev, mbc);
316 mbc->pcf = pdata->pcf; 315 mbc->pcf = dev_to_pcf50633(pdev->dev.parent);
317 316
318 /* Set up IRQ handlers */ 317 /* Set up IRQ handlers */
319 for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++) 318 for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++)