mmc: tmio: make tmio_mmc_request function more readable
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Fri, 19 May 2017 13:31:50 +0000 (15:31 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 20 Jun 2017 08:30:21 +0000 (10:30 +0200)
This part confused me and I had to read it twice until I got it. Let's
follow the standard pattern to bail out if something is wrong and keep
in the body of the function when everything is as expected.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/tmio_mmc_core.c

index a649a5ff9957402629a502f905c23c2e04d4f32f..5f5a4a2d81be7c0856fedaa74ec48b23376a88fd 100644 (file)
@@ -926,11 +926,12 @@ static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
        }
 
        ret = tmio_mmc_start_command(host, mrq->cmd);
-       if (!ret) {
-               schedule_delayed_work(&host->delayed_reset_work,
-                                     msecs_to_jiffies(CMDREQ_TIMEOUT));
-               return;
-       }
+       if (ret)
+               goto fail;
+
+       schedule_delayed_work(&host->delayed_reset_work,
+                             msecs_to_jiffies(CMDREQ_TIMEOUT));
+       return;
 
 fail:
        host->force_pio = false;