aboutsummaryrefslogtreecommitdiff
path: root/drivers/power/pcf50633-charger.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2009-10-07 02:49:34 +0200
committerPaul Fertser <fercerpav@gmail.com>2009-10-07 23:30:23 +0400
commit207ec43e8c5a54dfc82a0e65af5b8f2765e3cbb8 (patch)
treef1d4e8868fed7682728b1392f29d8bf21d75ddec /drivers/power/pcf50633-charger.c
parent593ab673a506c9849abd8d198ca8d068c3e92b09 (diff)
mfd: pcf50633: 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>
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 613b581a932..8424c40672a 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -363,7 +363,6 @@ static const u8 mbc_irq_handlers[] = {
static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
{
struct pcf50633_mbc *mbc;
- struct pcf50633_subdev_pdata *pdata = pdev->dev.platform_data;
int ret;
int i;
u8 mbcs1;
@@ -373,7 +372,7 @@ static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, mbc);
- mbc->pcf = pdata->pcf;
+ mbc->pcf = dev_to_pcf50633(pdev->dev.parent);
/* Set up IRQ handlers */
for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++)