From: Yu Kuai <yukuai3@huawei.com>
To: <robdclark@gmail.com>, <will@kernel.org>, <joro@8bytes.org>
Cc: yi.zhang@huawei.com, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
yukuai3@huawei.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
Date: Fri, 18 Sep 2020 09:13:57 +0800 [thread overview]
Message-ID: <20200918011357.909335-1-yukuai3@huawei.com> (raw)
if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.
Fixes: e86d1aa8b60f ("iommu/arm-smmu: Move Arm SMMU drivers into their own subdirectory")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 9535a6af7553..7a9594d221e0 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -584,8 +584,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
* index into qcom_iommu->ctxs:
*/
if (WARN_ON(asid < 1) ||
- WARN_ON(asid > qcom_iommu->num_ctxs))
+ WARN_ON(asid > qcom_iommu->num_ctxs)) {
+ put_device(&iommu_pdev->dev);
return -EINVAL;
+ }
if (!dev_iommu_priv_get(dev)) {
dev_iommu_priv_set(dev, qcom_iommu);
@@ -595,6 +597,7 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
* banks are ok, but multiple devices are not:
*/
if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
+ put_device(&iommu_pdev->dev);
return -EINVAL;
}
--
2.25.4
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2020-09-18 1:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 1:13 Yu Kuai [this message]
2020-09-21 17:50 ` [PATCH] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Will Deacon
2020-09-21 18:27 ` Rob Clark
2020-09-21 18:33 ` Rob Clark
2020-09-21 19:13 ` kernel test robot
2020-09-21 20:45 ` Will Deacon
2020-09-28 23:08 ` Will Deacon
2020-09-29 1:37 ` yukuai (C)
2020-09-23 4:32 ` kernel test robot
2020-09-18 15:17 Markus Elfring
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=20200918011357.909335-1-yukuai3@huawei.com \
--to=yukuai3@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=will@kernel.org \
--cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).