Skip to contentSkip to conversation

pci-gart_64: comparison between signed and unsigned

PATCH New Roel Kluin 1 participant 1 message Apr 19, 2008 x86

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 pci-gart_64: comparison between signed and unsigned

Can you confirm this is right, especially the last case?
---
Fix comparison between signed and unsigned

---

arch/x86/kernel/pci-gart_64.c +4 -4
index 700e464..7af1991 100644
@@ -97,12 +97,12 @@ static unsigned long alloc_iommu(struct device *dev, int size)
 	spin_lock_irqsave(&iommu_bitmap_lock, flags);
 	offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit,
 				  size, base_index, boundary_size, 0);
-	if (offset == -1) {
+	if (offset == -1ul) {
 		need_flush = 1;
 		offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0,
 					  size, base_index, boundary_size, 0);
 	}
-	if (offset != -1) {
+	if (offset != -1ul) {
 		set_bit_string(iommu_gart_bitmap, offset, size);
 		next_bit = offset+size;
 		if (next_bit >= iommu_pages) {
@@ -246,7 +246,7 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
 	unsigned long iommu_page = alloc_iommu(dev, npages);
 	int i;
 
-	if (iommu_page == -1) {
+	if (iommu_page == -1ul) {
 		if (!nonforced_iommu(dev, phys_mem, size))
 			return phys_mem;
 		if (panic_on_overflow)
@@ -372,7 +372,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start,
 	struct scatterlist *s;
 	int i;
 
-	if (iommu_start == -1)
+	if (iommu_start == -1ul)
 		return -1;
 
 	for_each_sg(start, s, nelems, i) {