diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-07 02:49:34 +0200 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2009-12-06 09:09:27 +0100 |
commit | 86b24e9fdd89f7cc8d3ea2c0a0b0fa733f2747ae (patch) | |
tree | a7b17ec0e30df831c7ee82d7e147752758263948 /drivers/input/misc/pcf50633-input.c | |
parent | ab21cebdabe8822abba40e5d84a489e7fded7f46 (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/input/misc/pcf50633-input.c')
-rw-r--r-- | drivers/input/misc/pcf50633-input.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/input/misc/pcf50633-input.c b/drivers/input/misc/pcf50633-input.c index 039dcb00ebd..008de0c5834 100644 --- a/drivers/input/misc/pcf50633-input.c +++ b/drivers/input/misc/pcf50633-input.c @@ -55,7 +55,6 @@ pcf50633_input_irq(int irq, void *data) static int __devinit pcf50633_input_probe(struct platform_device *pdev) { struct pcf50633_input *input; - struct pcf50633_subdev_pdata *pdata = pdev->dev.platform_data; struct input_dev *input_dev; int ret; @@ -71,7 +70,7 @@ static int __devinit pcf50633_input_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, input); - input->pcf = pdata->pcf; + input->pcf = dev_to_pcf50633(pdev->dev.parent); input->input_dev = input_dev; input_dev->name = "PCF50633 PMU events"; @@ -85,9 +84,9 @@ static int __devinit pcf50633_input_probe(struct platform_device *pdev) kfree(input); return ret; } - pcf50633_register_irq(pdata->pcf, PCF50633_IRQ_ONKEYR, + pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYR, pcf50633_input_irq, input); - pcf50633_register_irq(pdata->pcf, PCF50633_IRQ_ONKEYF, + pcf50633_register_irq(input->pcf, PCF50633_IRQ_ONKEYF, pcf50633_input_irq, input); return 0; |