* [PATCH] mmc: tmio: Use common error handling code in tmio_mmc_host_probe()
@ 2017-10-27 17:17 SF Markus Elfring
2017-10-30 11:40 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2017-10-27 17:17 UTC (permalink / raw)
To: linux-mmc, Ulf Hansson, Wolfram Sang; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 27 Oct 2017 19:09:17 +0200
* 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>
---
drivers/mmc/host/tmio_mmc_core.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index a7293e186e03..2e85d4048cec 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1286,23 +1286,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);
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: tmio: Use common error handling code in tmio_mmc_host_probe()
2017-10-27 17:17 [PATCH] mmc: tmio: Use common error handling code in tmio_mmc_host_probe() SF Markus Elfring
@ 2017-10-30 11:40 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2017-10-30 11:40 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-mmc@vger.kernel.org, Wolfram Sang, LKML, kernel-janitors
On 27 October 2017 at 19:17, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 27 Oct 2017 19:09:17 +0200
>
> * 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>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/tmio_mmc_core.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index a7293e186e03..2e85d4048cec 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1286,23 +1286,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);
>
> --
> 2.14.3
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-30 11:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27 17:17 [PATCH] mmc: tmio: Use common error handling code in tmio_mmc_host_probe() SF Markus Elfring
2017-10-30 11:40 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox