diff options
Diffstat (limited to 'drivers/pcmcia/pxa2xx_mainstone.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_mainstone.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 5d957dfe23d9..fda06941e730 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
@@ -171,27 +171,22 @@ static int __init mst_pcmcia_init(void) | |||
171 | { | 171 | { |
172 | int ret; | 172 | int ret; |
173 | 173 | ||
174 | mst_pcmcia_device = kzalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL); | 174 | mst_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
175 | if (!mst_pcmcia_device) | 175 | if (!mst_pcmcia_device) |
176 | return -ENOMEM; | 176 | return -ENOMEM; |
177 | mst_pcmcia_device->name = "pxa2xx-pcmcia"; | 177 | |
178 | mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; | 178 | mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; |
179 | 179 | ||
180 | ret = platform_device_register(mst_pcmcia_device); | 180 | ret = platform_device_add(mst_pcmcia_device); |
181 | |||
181 | if (ret) | 182 | if (ret) |
182 | kfree(mst_pcmcia_device); | 183 | platform_device_put(mst_pcmcia_device); |
183 | 184 | ||
184 | return ret; | 185 | return ret; |
185 | } | 186 | } |
186 | 187 | ||
187 | static void __exit mst_pcmcia_exit(void) | 188 | static void __exit mst_pcmcia_exit(void) |
188 | { | 189 | { |
189 | /* | ||
190 | * This call is supposed to free our mst_pcmcia_device. | ||
191 | * Unfortunately platform_device don't have a free method, and | ||
192 | * we can't assume it's free of any reference at this point so we | ||
193 | * can't free it either. | ||
194 | */ | ||
195 | platform_device_unregister(mst_pcmcia_device); | 190 | platform_device_unregister(mst_pcmcia_device); |
196 | } | 191 | } |
197 | 192 | ||