diff options
Diffstat (limited to 'arch/powerpc/kernel/iommu.c')
-rw-r--r-- | arch/powerpc/kernel/iommu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index ff5a6ce027b8..8226c6cb348a 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -215,7 +215,8 @@ static unsigned long iommu_range_alloc(struct device *dev, | |||
215 | spin_lock_irqsave(&(pool->lock), flags); | 215 | spin_lock_irqsave(&(pool->lock), flags); |
216 | 216 | ||
217 | again: | 217 | again: |
218 | if ((pass == 0) && handle && *handle) | 218 | if ((pass == 0) && handle && *handle && |
219 | (*handle >= pool->start) && (*handle < pool->end)) | ||
219 | start = *handle; | 220 | start = *handle; |
220 | else | 221 | else |
221 | start = pool->hint; | 222 | start = pool->hint; |
@@ -236,7 +237,9 @@ again: | |||
236 | * but on second pass, start at 0 in pool 0. | 237 | * but on second pass, start at 0 in pool 0. |
237 | */ | 238 | */ |
238 | if ((start & mask) >= limit || pass > 0) { | 239 | if ((start & mask) >= limit || pass > 0) { |
240 | spin_unlock(&(pool->lock)); | ||
239 | pool = &(tbl->pools[0]); | 241 | pool = &(tbl->pools[0]); |
242 | spin_lock(&(pool->lock)); | ||
240 | start = pool->start; | 243 | start = pool->start; |
241 | } else { | 244 | } else { |
242 | start &= mask; | 245 | start &= mask; |