diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-31 09:44:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-31 09:44:28 +0200 |
commit | 910cc9537302caddc9777cf3ae2f5582730380c9 (patch) | |
tree | 0dd42f4dd712fb6901b4f8c12f85508a7ad5b1ef /drivers/thunderbolt/dma_port.c | |
parent | fad92b11047a748c996ebd6cfb164a63814eeb2e (diff) | |
parent | 8124c8a6b35386f73523d27eacb71b5364a68c4c (diff) | |
download | linux-910cc9537302caddc9777cf3ae2f5582730380c9.tar.bz2 |
Merge 5.13-rc4 into tty-next
We need the tty/serial fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt/dma_port.c')
-rw-r--r-- | drivers/thunderbolt/dma_port.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/thunderbolt/dma_port.c b/drivers/thunderbolt/dma_port.c index 7288aaf01ae6..5631319f7b20 100644 --- a/drivers/thunderbolt/dma_port.c +++ b/drivers/thunderbolt/dma_port.c @@ -366,15 +366,15 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, void *buf, size_t size) { unsigned int retries = DMA_PORT_RETRIES; - unsigned int offset; - - offset = address & 3; - address = address & ~3; do { - u32 nbytes = min_t(u32, size, MAIL_DATA_DWORDS * 4); + unsigned int offset; + size_t nbytes; int ret; + offset = address & 3; + nbytes = min_t(size_t, size + offset, MAIL_DATA_DWORDS * 4); + ret = dma_port_flash_read_block(dma, address, dma->buf, ALIGN(nbytes, 4)); if (ret) { @@ -386,6 +386,7 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, return ret; } + nbytes -= offset; memcpy(buf, dma->buf + offset, nbytes); size -= nbytes; |