summaryrefslogtreecommitdiff
path: root/kernel/dma
diff options
context:
space:
mode:
authorClaire Chang <tientzu@chromium.org>2021-04-22 16:14:53 +0800
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2021-04-27 17:03:20 +0000
commit95b079d8215b83b37fa59341fda92fcb9392f14a (patch)
treef7330bb0dc76936d76320524d0f80c06dbe4ea4c /kernel/dma
parent2726bf3ff2520dba61fafc90a055640f7ad54e05 (diff)
swiotlb: Fix the type of index
Fix the type of index from unsigned int to int since find_slots() might return -1. Fixes: 26a7e094783d ("swiotlb: refactor swiotlb_tbl_map_single") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Claire Chang <tientzu@chromium.org> Signed-off-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/swiotlb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 0a5b6f7e75bc..8635a57f88e9 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -499,7 +499,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
{
struct io_tlb_mem *mem = io_tlb_default_mem;
unsigned int offset = swiotlb_align_offset(dev, orig_addr);
- unsigned int index, i;
+ unsigned int i;
+ int index;
phys_addr_t tlb_addr;
if (!mem)