mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 16:57:47 +07:00
mmc: core: optimize mmc_calc_max_discard
If the max_discard value is zero, the conditional branch that checks the trim capabilities will never update this value with max_trim. Change the condition statement to also check the max_discard value in order to avoid an unnecessary call to mmc_do_calc_max_discard. Signed-off-by: Sergio Valverde <vlvrdv@gmail.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
5a871bf081
commit
b305882fbc
@ -2369,7 +2369,7 @@ unsigned int mmc_calc_max_discard(struct mmc_card *card)
|
||||
return card->pref_erase;
|
||||
|
||||
max_discard = mmc_do_calc_max_discard(card, MMC_ERASE_ARG);
|
||||
if (mmc_can_trim(card)) {
|
||||
if (max_discard && mmc_can_trim(card)) {
|
||||
max_trim = mmc_do_calc_max_discard(card, MMC_TRIM_ARG);
|
||||
if (max_trim < max_discard)
|
||||
max_discard = max_trim;
|
||||
|
Loading…
Reference in New Issue
Block a user