Validation of page frame number doesn't require protection with a spinlock, let's move it out of spinlock for consistency. Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx> Acked-by: Thierry Reding <treding@xxxxxxxxxx> --- drivers/iommu/tegra-gart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index bc4cb200fa03..75e6ab621300 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -276,13 +276,13 @@ static int gart_iommu_map(struct iommu_domain *domain, unsigned long iova, if (!gart_iova_range_valid(gart, iova, bytes)) return -EINVAL; - spin_lock_irqsave(&gart->pte_lock, flags); pfn = __phys_to_pfn(pa); if (!pfn_valid(pfn)) { dev_err(gart->dev, "Invalid page: %pa\n", &pa); - spin_unlock_irqrestore(&gart->pte_lock, flags); return -EINVAL; } + + spin_lock_irqsave(&gart->pte_lock, flags); if (IS_ENABLED(TEGRA_IOMMU_GART_DEBUG)) { pte = gart_read_pte(gart, iova); if (pte & GART_ENTRY_PHYS_ADDR_VALID) { -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html