mmc: block: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()
authorUlf Hansson <ulf.hansson@linaro.org>
Fri, 17 Oct 2014 09:39:05 +0000 (11:39 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 10 Nov 2014 11:40:44 +0000 (12:40 +0100)
By using mmc_get_ext_csd() in favor of mmc_send_ext_csd, we decrease
code duplication.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/card/block.c

index f45f7e3870befb0dff5d0b23126fcd75af61e98f..0c41ee043e36d8cda0ac43834e77663018b51f1a 100644 (file)
@@ -1309,19 +1309,11 @@ static int mmc_blk_packed_err_check(struct mmc_card *card,
        }
 
        if (status & R1_EXCEPTION_EVENT) {
-               ext_csd = kzalloc(512, GFP_KERNEL);
-               if (!ext_csd) {
-                       pr_err("%s: unable to allocate buffer for ext_csd\n",
-                              req->rq_disk->disk_name);
-                       return -ENOMEM;
-               }
-
-               err = mmc_send_ext_csd(card, ext_csd);
+               err = mmc_get_ext_csd(card, &ext_csd);
                if (err) {
                        pr_err("%s: error %d sending ext_csd\n",
                               req->rq_disk->disk_name, err);
-                       check = MMC_BLK_ABORT;
-                       goto free;
+                       return MMC_BLK_ABORT;
                }
 
                if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS] &
@@ -1339,7 +1331,6 @@ static int mmc_blk_packed_err_check(struct mmc_card *card,
                               req->rq_disk->disk_name, packed->nr_entries,
                               packed->blocks, packed->idx_failure);
                }
-free:
                kfree(ext_csd);
        }