Skip to contentSkip to conversation

iommu/tegra: smmu: Cleanup with lesser nest

PATCH Applied Hiroshi Doyu 2 participants 3 messages Jul 30, 2012 – Aug 3, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iommu/tegra: smmu: Cleanup with lesser nest

Small clean up with lesser nest for readability.

---
 drivers/iommu/tegra-smmu.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/iommu/tegra-smmu.c +8 -5
index 4ba325a..2be5ac2 100644
@@ -814,11 +814,14 @@ static int smmu_iommu_domain_init(struct iommu_domain *domain)
 	/* Look for a free AS with lock held */
 	for  (i = 0; i < smmu->num_as; i++) {
 		as = &smmu->as[i];
-		if (!as->pdir_page) {
-			err = alloc_pdir(as);
-			if (!err)
-				goto found;
-		}
+
+		if (as->pdir_page)
+			continue;
+
+		err = alloc_pdir(as);
+		if (!err)
+			goto found;
+
 		if (err != -EAGAIN)
 			break;
 	}
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/2 iommu/tegra: smmu: Fix error initial value at domain_init

In reply to a message not in the archive

err initial value should be -EAGAIN. Otherwise 2nd iteration always fails in the case as[0] is occupied.

---
 drivers/iommu/tegra-smmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/iommu/tegra-smmu.c +1 -1
index 2be5ac2..7c9174d 100644
@@ -806,7 +806,7 @@ out:
 
 static int smmu_iommu_domain_init(struct iommu_domain *domain)
 {
-	int i, err = -ENODEV;
+	int i, err = -EAGAIN;
 	unsigned long flags;
 	struct smmu_as *as;
 	struct smmu_device *smmu = smmu_handle;
Signature · 1 line
1.7.5.4
Applied
#3 lore raw
In reply to a message not in the archive
Quoted 3 lines · Hiroshi Doyu

Small clean up with lesser nest for readability.

Applied both to iommu/fixes, thanks Hiroshi.

Signature · 5 lines
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632