]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
swiotlb: Fix the type of index
authorClaire Chang <tientzu@chromium.org>
Thu, 22 Apr 2021 08:14:53 +0000 (16:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:56:27 +0000 (10:56 +0200)
[ Upstream commit 95b079d8215b83b37fa59341fda92fcb9392f14a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/dma/swiotlb.c

index c10e855a03bc1690b473e44e4c3e1c3b6ecc0d50..fe4c01c14ab2c96f6eea60dd460d81cbd9a0ac2a 100644 (file)
@@ -608,7 +608,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr,
                enum dma_data_direction dir, unsigned long attrs)
 {
        unsigned int offset = swiotlb_align_offset(dev, orig_addr);
-       unsigned int index, i;
+       unsigned int i;
+       int index;
        phys_addr_t tlb_addr;
 
        if (no_iotlb_memory)