Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()

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>

+4 -22
+3 -14
drivers/mmc/core/core.c
··· 731 731 int err; 732 732 u8 *ext_csd; 733 733 734 - /* 735 - * In future work, we should consider storing the entire ext_csd. 736 - */ 737 - ext_csd = kmalloc(512, GFP_KERNEL); 738 - if (!ext_csd) { 739 - pr_err("%s: could not allocate buffer to receive the ext_csd.\n", 740 - mmc_hostname(card->host)); 741 - return -ENOMEM; 742 - } 743 - 744 734 mmc_claim_host(card->host); 745 - err = mmc_send_ext_csd(card, ext_csd); 735 + err = mmc_get_ext_csd(card, &ext_csd); 746 736 mmc_release_host(card->host); 747 737 if (err) 748 - goto out; 738 + return err; 749 739 750 740 card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; 751 741 card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; 752 - out: 753 742 kfree(ext_csd); 754 - return err; 743 + return 0; 755 744 } 756 745 EXPORT_SYMBOL(mmc_read_bkops_status); 757 746
+1 -8
drivers/mmc/core/debugfs.c
··· 291 291 if (!buf) 292 292 return -ENOMEM; 293 293 294 - ext_csd = kmalloc(512, GFP_KERNEL); 295 - if (!ext_csd) { 296 - err = -ENOMEM; 297 - goto out_free; 298 - } 299 - 300 294 mmc_get_card(card); 301 - err = mmc_send_ext_csd(card, ext_csd); 295 + err = mmc_get_ext_csd(card, &ext_csd); 302 296 mmc_put_card(card); 303 297 if (err) 304 298 goto out_free; ··· 308 314 309 315 out_free: 310 316 kfree(buf); 311 - kfree(ext_csd); 312 317 return err; 313 318 } 314 319