* [PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call
@ 2017-09-06 5:50 Pushkar Jambhlekar
0 siblings, 0 replies; only message in thread
From: Pushkar Jambhlekar @ 2017-09-06 5:50 UTC (permalink / raw)
To: Hiroshi Doyu, Joerg Roedel, Thierry Reding, Jonathan Hunter
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Pushkar Jambhlekar
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-06 5:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-06 5:50 [PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call Pushkar Jambhlekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).