From: Pushkar Jambhlekar <pushkar.iit@gmail.com>
To: Hiroshi Doyu <hdoyu@nvidia.com>, Joerg Roedel <joro@8bytes.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>
Cc: iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org,
Pushkar Jambhlekar <pushkar.iit@gmail.com>
Subject: [PATCH] drivers/iommu/tegra: Optimize mutex_unlock function call
Date: Wed, 6 Sep 2017 11:20:37 +0530 [thread overview]
Message-ID: <1504677037-3224-1-git-send-email-pushkar.iit@gmail.com> (raw)
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
reply other threads:[~2017-09-06 5:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504677037-3224-1-git-send-email-pushkar.iit@gmail.com \
--to=pushkar.iit@gmail.com \
--cc=hdoyu@nvidia.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome