diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2010-11-03 16:26:42 +0100 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-12-20 23:07:37 +0800 |
commit | a4257af5b0c5479bb81597579841e9daaeccd7f6 (patch) | |
tree | 9a46d53b4538a25233991ce8ca317264ad6f133d /drivers/pcmcia | |
parent | ef6c84454f8567d4968c210d7d194fb711ed3739 (diff) | |
download | kernel_samsung_tuna-a4257af5b0c5479bb81597579841e9daaeccd7f6.zip kernel_samsung_tuna-a4257af5b0c5479bb81597579841e9daaeccd7f6.tar.gz kernel_samsung_tuna-a4257af5b0c5479bb81597579841e9daaeccd7f6.tar.bz2 |
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')
-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 3c01774..3755e7c 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) struct clk *clk; ops = (struct pcmcia_low_level *)dev->dev.platform_data; - if (!ops) - return -ENODEV; + if (!ops) { + ret = -ENODEV; + goto err0; + } + + if (cpu_is_pxa320() && ops->nr > 1) { + dev_err(&dev->dev, "pxa320 supports only one pcmcia slot"); + ret = -EINVAL; + goto err0; + } clk = clk_get(&dev->dev, NULL); if (!clk) @@ -316,7 +324,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) ret = pxa2xx_drv_pcmcia_add_one(skt); if (ret) - break; + goto err1; } if (ret) { @@ -329,6 +337,13 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) dev_set_drvdata(&dev->dev, sinfo); } + return 0; + +err1: + while (--i >= 0) + soc_pcmcia_remove_one(&sinfo->skt[i]); + kfree(sinfo); +err0: return ret; } |