diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-04-24 14:28:11 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-06-02 12:49:16 (GMT) |
commit | 4e5e8de0dbdeb08df2b4c15fa2b0ba2216091793 (patch) | |
tree | cda179e4e8e7eaf1984f90638fba143b6dd8b228 /drivers/pcmcia/pxa2xx_mainstone.c | |
parent | 04ba0f656f7580d8a51a5b3441e088309141b67a (diff) | |
download | linux-fsl-qoriq-4e5e8de0dbdeb08df2b4c15fa2b0ba2216091793.tar.xz |
[ARM] pxa: avoid kfreeing static data if platform device fails to register
When a dynamically allocated platform device is 'put', the platform
device's platform_data is kfree'd. This is bad if it's pointing at
static data. Use the provided function to register platform data
for these devices.
This also means we can mark the pcmcia ops structures as __initdata.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia/pxa2xx_mainstone.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_mainstone.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 36a5996..92d1cc3 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c @@ -137,7 +137,7 @@ static void mst_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) { } -static struct pcmcia_low_level mst_pcmcia_ops = { +static struct pcmcia_low_level mst_pcmcia_ops __initdata = { .owner = THIS_MODULE, .hw_init = mst_pcmcia_hw_init, .hw_shutdown = mst_pcmcia_hw_shutdown, @@ -161,9 +161,10 @@ static int __init mst_pcmcia_init(void) if (!mst_pcmcia_device) return -ENOMEM; - mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; - - ret = platform_device_add(mst_pcmcia_device); + ret = platform_device_add_data(mst_pcmcia_device, &mst_pcmcia_ops, + sizeof(mst_pcmcia_ops)); + if (ret == 0) + ret = platform_device_add(mst_pcmcia_device); if (ret) platform_device_put(mst_pcmcia_device); |