Skip to content

Commit

Permalink
ARM: pxa: Add pxa320 PCMCIA check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Vasut authored and Eric Miao committed Dec 20, 2010
1 parent ef6c844 commit a4257af
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions drivers/pcmcia/pxa2xx_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit a4257af

Please sign in to comment.