mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	
				The original purpose of the code I fix is to replace max_discard with
max_trim if max_trim is less than max_discard. When max_discard is 0
we should replace max_discard with max_trim as well, because
max_discard equals 0 happens only when the max_do_calc_max_discard
process is overflowed, so if mmc_can_trim(card) is true, max_discard
should be replaced by an available max_trim.
However, in the original code, there are two lines of code interfere
the right process.
1) if (max_discard && mmc_can_trim(card))
when max_discard is 0, it skips the process checking if max_discard
needs to be replaced with max_trim.
2) if (max_trim < max_discard)
the condition is false when max_discard is 0. it also skips the process
that replaces max_discard with max_trim, in fact, we should replace the
0-valued max_discard with max_trim.
Signed-off-by: Jiong Wu <Lohengrin1024@gmail.com>
Fixes: 
		
	
					 | 
			||
|---|---|---|
| .. | ||
| block.c | ||
| block.h | ||
| bus.c | ||
| bus.h | ||
| card.h | ||
| core.c | ||
| core.h | ||
| debugfs.c | ||
| host.c | ||
| host.h | ||
| Kconfig | ||
| Makefile | ||
| mmc.c | ||
| mmc_ops.c | ||
| mmc_ops.h | ||
| mmc_test.c | ||
| pwrseq.c | ||
| pwrseq.h | ||
| pwrseq_emmc.c | ||
| pwrseq_sd8787.c | ||
| pwrseq_simple.c | ||
| queue.c | ||
| queue.h | ||
| quirks.h | ||
| regulator.c | ||
| sd.c | ||
| sd.h | ||
| sd_ops.c | ||
| sd_ops.h | ||
| sdio.c | ||
| sdio_bus.c | ||
| sdio_bus.h | ||
| sdio_cis.c | ||
| sdio_cis.h | ||
| sdio_io.c | ||
| sdio_irq.c | ||
| sdio_ops.c | ||
| sdio_ops.h | ||
| sdio_uart.c | ||
| slot-gpio.c | ||
| slot-gpio.h | ||