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

Configure Feed

Select the types of activity you want to include in your feed.

mvsdio: fix handling of partial word at the end of PIO transfer

Standard data flow for MMC/SD/SDIO cards requires that the mvsdio
controller be set for big endian operation. This is causing problems
with buffers which length is not a multiple of 4 bytes as the last
partial word doesn't get shifted all the way and stored properly in
memory. Let's compensate for this.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
CC: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Nicolas Pitre and committed by
Linus Torvalds
6cdbf734 0ecf24ef

+2 -2
+2 -2
drivers/mmc/host/mvsdio.c
··· 384 384 u16 val[2] = {0, 0}; 385 385 val[0] = mvsd_read(MVSD_FIFO); 386 386 val[1] = mvsd_read(MVSD_FIFO); 387 - memcpy(p, &val, s); 387 + memcpy(p, ((void *)&val) + 4 - s, s); 388 388 s = 0; 389 389 intr_status = mvsd_read(MVSD_NOR_INTR_STATUS); 390 390 } ··· 423 423 if (s < 4) { 424 424 if (s && (intr_status & MVSD_NOR_TX_AVAIL)) { 425 425 u16 val[2] = {0, 0}; 426 - memcpy(&val, p, s); 426 + memcpy(((void *)&val) + 4 - s, p, s); 427 427 mvsd_write(MVSD_FIFO, val[0]); 428 428 mvsd_write(MVSD_FIFO, val[1]); 429 429 s = 0;