diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2010-11-03 11:26:42 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-12-20 10:07:37 -0500 |
commit | a4257af5b0c5479bb81597579841e9daaeccd7f6 (patch) | |
tree | 9a46d53b4538a25233991ce8ca317264ad6f133d /drivers/pcmcia/pxa2xx_base.c | |
parent | ef6c84454f8567d4968c210d7d194fb711ed3739 (diff) |
ARM: pxa: Add pxa320 PCMCIA check
On PXA320, there's only one PCMCIA slot available. Check for cases where the
user would want to register multiple. Also, rework failpath.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers/pcmcia/pxa2xx_base.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 3c01774eb39..3755e7c8c71 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -285,8 +285,16 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
285 | struct clk *clk; | 285 | struct clk *clk; |
286 | 286 | ||
287 | ops = (struct pcmcia_low_level *)dev->dev.platform_data; | 287 | ops = (struct pcmcia_low_level *)dev->dev.platform_data; |
288 | if (!ops) | 288 | if (!ops) { |
289 | return -ENODEV; | 289 | ret = -ENODEV; |
290 | goto err0; | ||
291 | } | ||
292 | |||
293 | if (cpu_is_pxa320() && ops->nr > 1) { | ||
294 | dev_err(&dev->dev, "pxa320 supports only one pcmcia slot"); | ||
295 | ret = -EINVAL; | ||
296 | goto err0; | ||
297 | } | ||
290 | 298 | ||
291 | clk = clk_get(&dev->dev, NULL); | 299 | clk = clk_get(&dev->dev, NULL); |
292 | if (!clk) | 300 | if (!clk) |
@@ -316,7 +324,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
316 | 324 | ||
317 | ret = pxa2xx_drv_pcmcia_add_one(skt); | 325 | ret = pxa2xx_drv_pcmcia_add_one(skt); |
318 | if (ret) | 326 | if (ret) |
319 | break; | 327 | goto err1; |
320 | } | 328 | } |
321 | 329 | ||
322 | if (ret) { | 330 | if (ret) { |
@@ -329,6 +337,13 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
329 | dev_set_drvdata(&dev->dev, sinfo); | 337 | dev_set_drvdata(&dev->dev, sinfo); |
330 | } | 338 | } |
331 | 339 | ||
340 | return 0; | ||
341 | |||
342 | err1: | ||
343 | while (--i >= 0) | ||
344 | soc_pcmcia_remove_one(&sinfo->skt[i]); | ||
345 | kfree(sinfo); | ||
346 | err0: | ||
332 | return ret; | 347 | return ret; |
333 | } | 348 | } |
334 | 349 | ||