path: root/drivers/rtc
diff options
authorLars-Peter Clausen <>2009-10-14 02:12:33 +0400
committerSamuel Ortiz <>2009-12-13 19:21:17 +0100
commit68d641efd86d901d000b888eeab5481257d49f12 (patch)
treea916769e71d50c0d20725cad60fb0402da198692 /drivers/rtc
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 <> Signed-off-by: Paul Fertser <> Signed-off-by: Samuel Ortiz <>
Diffstat (limited to 'drivers/rtc')
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 4c5d5d0c4cfc..9b74e9c9151c 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -277,16 +277,13 @@ static void pcf50633_rtc_irq(int irq, void *data)
static int __devinit pcf50633_rtc_probe(struct platform_device *pdev)
- struct pcf50633_subdev_pdata *pdata;
struct pcf50633_rtc *rtc;
rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
- pdata = pdev->dev.platform_data;
- rtc->pcf = pdata->pcf;
+ rtc->pcf = dev_to_pcf50633(pdev->dev.parent);
platform_set_drvdata(pdev, rtc);
rtc->rtc_dev = rtc_device_register("pcf50633-rtc", &pdev->dev,
&pcf50633_rtc_ops, THIS_MODULE);