summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2019-02-15 23:03:04 +0100
committerPaul Burton <paul.burton@mips.com>2019-02-19 21:17:43 +0100
commitd411da06abbe4c7cad0cc16b509d10b43da783a8 (patch)
tree65bd55f58f21cbd450fe78e981b916b087c622a9 /arch
parentMIPS: eBPF: Remove REG_32BIT_ZERO_EX (diff)
downloadlinux-d411da06abbe4c7cad0cc16b509d10b43da783a8.tar.xz
linux-d411da06abbe4c7cad0cc16b509d10b43da783a8.zip
MIPS: dma-noncoherent: Remove bogus condition in dma_sync_phys()
Commit e36863a550da ("MIPS: HIGHMEM DMA on noncoherent MIPS32 processors") introduced code which: 1) Calculates an offset within a page, by ANDing an address with ~PAGE_MASK. 2) Checks whether that offset is >= PAGE_SIZE. This check can never evaluate true, making the code it guards unreachable. smatch spots bogus arithmetic resulting from the impossible condition, resulting in the following warning: arch/mips/mm/dma-noncoherent.c:125 dma_sync_phys() warn: mask and shift to zero Fix this by removing the impossible to satisfy condition & the unreachable code it guards. Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org Cc: Christoph Hellwig <hch@lst.de> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Robin Murphy <robin.murphy@arm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/mm/dma-noncoherent.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c
index f7e0fd6b7619..b57465733e87 100644
--- a/arch/mips/mm/dma-noncoherent.c
+++ b/arch/mips/mm/dma-noncoherent.c
@@ -120,13 +120,8 @@ static inline void dma_sync_phys(phys_addr_t paddr, size_t size,
if (PageHighMem(page)) {
void *addr;
- if (offset + len > PAGE_SIZE) {
- if (offset >= PAGE_SIZE) {
- page += offset >> PAGE_SHIFT;
- offset &= ~PAGE_MASK;
- }
+ if (offset + len > PAGE_SIZE)
len = PAGE_SIZE - offset;
- }
addr = kmap_atomic(page);
dma_sync_virt(addr + offset, len, dir);