Skip to content

Commit

Permalink
mmc: tmio: Use common error handling code in tmio_mmc_host_probe()
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
  • Loading branch information
elfring authored and storulf committed Nov 2, 2017
1 parent 2ee4f62 commit 7f8e446
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/mmc/host/tmio_mmc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,23 +1302,24 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
pm_runtime_enable(&pdev->dev);

ret = mmc_add_host(mmc);
if (ret < 0) {
tmio_mmc_host_remove(_host);
return ret;
}
if (ret)
goto remove_host;

dev_pm_qos_expose_latency_limit(&pdev->dev, 100);

if (pdata->flags & TMIO_MMC_USE_GPIO_CD) {
ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0);
if (ret < 0) {
tmio_mmc_host_remove(_host);
return ret;
}
if (ret)
goto remove_host;

mmc_gpiod_request_cd_irq(mmc);
}

return 0;

remove_host:
tmio_mmc_host_remove(_host);
return ret;
}
EXPORT_SYMBOL_GPL(tmio_mmc_host_probe);

Expand Down

0 comments on commit 7f8e446

Please sign in to comment.