提交 7f8e446b 编写于 作者: M Markus Elfring 提交者: Ulf Hansson

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: NMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 2ee4f620
...@@ -1302,23 +1302,24 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, ...@@ -1302,23 +1302,24 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = mmc_add_host(mmc); ret = mmc_add_host(mmc);
if (ret < 0) { if (ret)
tmio_mmc_host_remove(_host); goto remove_host;
return ret;
}
dev_pm_qos_expose_latency_limit(&pdev->dev, 100); dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { if (pdata->flags & TMIO_MMC_USE_GPIO_CD) {
ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0); ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0);
if (ret < 0) { if (ret)
tmio_mmc_host_remove(_host); goto remove_host;
return ret;
}
mmc_gpiod_request_cd_irq(mmc); mmc_gpiod_request_cd_irq(mmc);
} }
return 0; return 0;
remove_host:
tmio_mmc_host_remove(_host);
return ret;
} }
EXPORT_SYMBOL_GPL(tmio_mmc_host_probe); EXPORT_SYMBOL_GPL(tmio_mmc_host_probe);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册