aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-10-27 13:09:17 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-11-02 10:20:29 -0400
commit7f8e446b032bd6bbcec7c2f068d0a4f2d5929249 (patch)
tree9245ed5525bd50ffa47595c74bee26884dd536f9
parent2ee4f6200597bda9713e28a9c1e65a392615b4b5 (diff)
mmc: tmio: Use common error handling code in tmio_mmc_host_probe()
* Add a jump target so that a bit of exception handling can be better reused at the end of this function. * Adjust condition checks. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/tmio_mmc_core.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 3a6d49f07e22..4c8198f8b04a 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1302,23 +1302,24 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
1302 pm_runtime_enable(&pdev->dev); 1302 pm_runtime_enable(&pdev->dev);
1303 1303
1304 ret = mmc_add_host(mmc); 1304 ret = mmc_add_host(mmc);
1305 if (ret < 0) { 1305 if (ret)
1306 tmio_mmc_host_remove(_host); 1306 goto remove_host;
1307 return ret;
1308 }
1309 1307
1310 dev_pm_qos_expose_latency_limit(&pdev->dev, 100); 1308 dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
1311 1309
1312 if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { 1310 if (pdata->flags & TMIO_MMC_USE_GPIO_CD) {
1313 ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0); 1311 ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0);
1314 if (ret < 0) { 1312 if (ret)
1315 tmio_mmc_host_remove(_host); 1313 goto remove_host;
1316 return ret; 1314
1317 }
1318 mmc_gpiod_request_cd_irq(mmc); 1315 mmc_gpiod_request_cd_irq(mmc);
1319 } 1316 }
1320 1317
1321 return 0; 1318 return 0;
1319
1320remove_host:
1321 tmio_mmc_host_remove(_host);
1322 return ret;
1322} 1323}
1323EXPORT_SYMBOL_GPL(tmio_mmc_host_probe); 1324EXPORT_SYMBOL_GPL(tmio_mmc_host_probe);
1324 1325