Skip to content

Commit d411da0

Browse files
committed
MIPS: dma-noncoherent: Remove bogus condition in dma_sync_phys()
Commit e36863a ("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>
1 parent 66b6572 commit d411da0

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

arch/mips/mm/dma-noncoherent.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ static inline void dma_sync_phys(phys_addr_t paddr, size_t size,
120120
if (PageHighMem(page)) {
121121
void *addr;
122122

123-
if (offset + len > PAGE_SIZE) {
124-
if (offset >= PAGE_SIZE) {
125-
page += offset >> PAGE_SHIFT;
126-
offset &= ~PAGE_MASK;
127-
}
123+
if (offset + len > PAGE_SIZE)
128124
len = PAGE_SIZE - offset;
129-
}
130125

131126
addr = kmap_atomic(page);
132127
dma_sync_virt(addr + offset, len, dir);

0 commit comments

Comments
 (0)