Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727170 > unrolled thread

[PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call

Started byPushkar Jambhlekar <pushkar.iit@gmail.com>
First post2017-09-06 08:00 +0200
Last post2017-09-06 08:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call Pushkar Jambhlekar <pushkar.iit@gmail.com> - 2017-09-06 08:00 +0200

#1727170 — [PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call

FromPushkar Jambhlekar <pushkar.iit@gmail.com>
Date2017-09-06 08:00 +0200
Subject[PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call
Message-ID<umBxw-5mw-11@gated-at.bofh.it>
Code can be optimized more by making single exit point of function and calling mutex_unlock at the end

Signed-off-by: Pushkar Jambhlekar <pushkar.iit@gmail.com>
---
 drivers/iommu/tegra-smmu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 3b6449e..da38833 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -232,20 +232,22 @@ static inline void smmu_flush(struct tegra_smmu *smmu)
 static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp)
 {
 	unsigned long id;
+	int ret = 0;
 
 	mutex_lock(&smmu->lock);
 
 	id = find_first_zero_bit(smmu->asids, smmu->soc->num_asids);
 	if (id >= smmu->soc->num_asids) {
-		mutex_unlock(&smmu->lock);
-		return -ENOSPC;
+		ret = -ENOSPC;
+		goto Exit;
 	}
 
 	set_bit(id, smmu->asids);
 	*idp = id;
 
+Exit:
 	mutex_unlock(&smmu->lock);
-	return 0;
+	return ret;
 }
 
 static void tegra_smmu_free_asid(struct tegra_smmu *smmu, unsigned int id)
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web