aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-04-19 10:15:52 -0400
committerChris Ball <cjb@laptop.org>2012-07-21 00:02:13 -0400
commite1aae2eb3f7c446a2680a3a0ccd05aa50521b4e2 (patch)
tree0229e58fa9e353e460d91d6637676b9052663fb5
parent944640d0fffb2ee2961a24c3747b1fc87c4157a8 (diff)
mmc: sh_mmcif: simplify and use meaningful label names in error-handling
A check for NULL platform data can be conveniently made in the very beginning of probing. Replace numbered error-handling labels in .probe() with meaningful names to make any future reorganisation simpler. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sh_mmcif.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index e32da1126e8d..d6ffb0557537 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1241,11 +1241,16 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1241 int ret = 0, irq[2]; 1241 int ret = 0, irq[2];
1242 struct mmc_host *mmc; 1242 struct mmc_host *mmc;
1243 struct sh_mmcif_host *host; 1243 struct sh_mmcif_host *host;
1244 struct sh_mmcif_plat_data *pd; 1244 struct sh_mmcif_plat_data *pd = pdev->dev.platform_data;
1245 struct resource *res; 1245 struct resource *res;
1246 void __iomem *reg; 1246 void __iomem *reg;
1247 char clk_name[8]; 1247 char clk_name[8];
1248 1248
1249 if (!pd) {
1250 dev_err(&pdev->dev, "sh_mmcif plat data error.\n");
1251 return -ENXIO;
1252 }
1253
1249 irq[0] = platform_get_irq(pdev, 0); 1254 irq[0] = platform_get_irq(pdev, 0);
1250 irq[1] = platform_get_irq(pdev, 1); 1255 irq[1] = platform_get_irq(pdev, 1);
1251 if (irq[0] < 0 || irq[1] < 0) { 1256 if (irq[0] < 0 || irq[1] < 0) {
@@ -1262,16 +1267,11 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1262 dev_err(&pdev->dev, "ioremap error.\n"); 1267 dev_err(&pdev->dev, "ioremap error.\n");
1263 return -ENOMEM; 1268 return -ENOMEM;
1264 } 1269 }
1265 pd = pdev->dev.platform_data; 1270
1266 if (!pd) {
1267 dev_err(&pdev->dev, "sh_mmcif plat data error.\n");
1268 ret = -ENXIO;
1269 goto clean_up;
1270 }
1271 mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), &pdev->dev); 1271 mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), &pdev->dev);
1272 if (!mmc) { 1272 if (!mmc) {
1273 ret = -ENOMEM; 1273 ret = -ENOMEM;
1274 goto clean_up; 1274 goto ealloch;
1275 } 1275 }
1276 host = mmc_priv(mmc); 1276 host = mmc_priv(mmc);
1277 host->mmc = mmc; 1277 host->mmc = mmc;
@@ -1283,7 +1283,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1283 if (IS_ERR(host->hclk)) { 1283 if (IS_ERR(host->hclk)) {
1284 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); 1284 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
1285 ret = PTR_ERR(host->hclk); 1285 ret = PTR_ERR(host->hclk);
1286 goto clean_up1; 1286 goto eclkget;
1287 } 1287 }
1288 clk_enable(host->hclk); 1288 clk_enable(host->hclk);
1289 host->clk = clk_get_rate(host->hclk); 1289 host->clk = clk_get_rate(host->hclk);
@@ -1313,7 +1313,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1313 1313
1314 ret = pm_runtime_resume(&pdev->dev); 1314 ret = pm_runtime_resume(&pdev->dev);
1315 if (ret < 0) 1315 if (ret < 0)
1316 goto clean_up2; 1316 goto eresume;
1317 1317
1318 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); 1318 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
1319 1319
@@ -1322,17 +1322,17 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1322 ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:error", host); 1322 ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:error", host);
1323 if (ret) { 1323 if (ret) {
1324 dev_err(&pdev->dev, "request_irq error (sh_mmc:error)\n"); 1324 dev_err(&pdev->dev, "request_irq error (sh_mmc:error)\n");
1325 goto clean_up3; 1325 goto ereqirq0;
1326 } 1326 }
1327 ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:int", host); 1327 ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:int", host);
1328 if (ret) { 1328 if (ret) {
1329 dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n"); 1329 dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
1330 goto clean_up4; 1330 goto ereqirq1;
1331 } 1331 }
1332 1332
1333 ret = mmc_add_host(mmc); 1333 ret = mmc_add_host(mmc);
1334 if (ret < 0) 1334 if (ret < 0)
1335 goto clean_up5; 1335 goto emmcaddh;
1336 1336
1337 dev_pm_qos_expose_latency_limit(&pdev->dev, 100); 1337 dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
1338 1338
@@ -1341,20 +1341,19 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1341 sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff); 1341 sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
1342 return ret; 1342 return ret;
1343 1343
1344clean_up5: 1344emmcaddh:
1345 free_irq(irq[1], host); 1345 free_irq(irq[1], host);
1346clean_up4: 1346ereqirq1:
1347 free_irq(irq[0], host); 1347 free_irq(irq[0], host);
1348clean_up3: 1348ereqirq0:
1349 pm_runtime_suspend(&pdev->dev); 1349 pm_runtime_suspend(&pdev->dev);
1350clean_up2: 1350eresume:
1351 pm_runtime_disable(&pdev->dev); 1351 pm_runtime_disable(&pdev->dev);
1352 clk_disable(host->hclk); 1352 clk_disable(host->hclk);
1353clean_up1: 1353eclkget:
1354 mmc_free_host(mmc); 1354 mmc_free_host(mmc);
1355clean_up: 1355ealloch:
1356 if (reg) 1356 iounmap(reg);
1357 iounmap(reg);
1358 return ret; 1357 return ret;
1359} 1358}
1360 1359