diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-13 18:12:33 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-12-13 13:21:17 -0500 |
commit | 68d641efd86d901d000b888eeab5481257d49f12 (patch) | |
tree | a916769e71d50c0d20725cad60fb0402da198692 /drivers/mfd/pcf50633-adc.c | |
parent | b18fdc4b3e5e418e5582f5403c8a05b2c67eea16 (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/mfd/pcf50633-adc.c')
-rw-r--r-- | drivers/mfd/pcf50633-adc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mfd/pcf50633-adc.c b/drivers/mfd/pcf50633-adc.c index 3d31e97d6a45..6d2e8466df1d 100644 --- a/drivers/mfd/pcf50633-adc.c +++ b/drivers/mfd/pcf50633-adc.c | |||
@@ -209,17 +209,16 @@ static void pcf50633_adc_irq(int irq, void *data) | |||
209 | 209 | ||
210 | static int __devinit pcf50633_adc_probe(struct platform_device *pdev) | 210 | static int __devinit pcf50633_adc_probe(struct platform_device *pdev) |
211 | { | 211 | { |
212 | struct pcf50633_subdev_pdata *pdata = pdev->dev.platform_data; | ||
213 | struct pcf50633_adc *adc; | 212 | struct pcf50633_adc *adc; |
214 | 213 | ||
215 | adc = kzalloc(sizeof(*adc), GFP_KERNEL); | 214 | adc = kzalloc(sizeof(*adc), GFP_KERNEL); |
216 | if (!adc) | 215 | if (!adc) |
217 | return -ENOMEM; | 216 | return -ENOMEM; |
218 | 217 | ||
219 | adc->pcf = pdata->pcf; | 218 | adc->pcf = dev_to_pcf50633(pdev->dev.parent); |
220 | platform_set_drvdata(pdev, adc); | 219 | platform_set_drvdata(pdev, adc); |
221 | 220 | ||
222 | pcf50633_register_irq(pdata->pcf, PCF50633_IRQ_ADCRDY, | 221 | pcf50633_register_irq(adc->pcf, PCF50633_IRQ_ADCRDY, |
223 | pcf50633_adc_irq, adc); | 222 | pcf50633_adc_irq, adc); |
224 | 223 | ||
225 | mutex_init(&adc->queue_mutex); | 224 | mutex_init(&adc->queue_mutex); |