* [PATCH V2] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
@ 2020-09-29 1:40 Yu Kuai
2020-09-29 17:13 ` Will Deacon
0 siblings, 1 reply; 2+ messages in thread
From: Yu Kuai @ 2020-09-29 1:40 UTC (permalink / raw)
To: robdclark, will, joro
Cc: iommu, linux-arm-msm, linux-arm-kernel, linux-kernel, yukuai3, yi.zhang
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: 0ae349a0f33fb ("iommu/qcom: Add qcom_iommu")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
Changes in V2:
- Fix wrong 'Fixes'
- add missing '{}' after if
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 9535a6af7553..b30d6c966e2c 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);
@@ -594,8 +596,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
* multiple different iommu devices. Multiple context
* banks are ok, but multiple devices are not:
*/
- if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev)))
+ if (WARN_ON(qcom_iommu != dev_iommu_priv_get(dev))) {
+ put_device(&iommu_pdev->dev);
return -EINVAL;
+ }
}
return iommu_fwspec_add_ids(dev, &asid, 1);
--
2.25.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
2020-09-29 1:40 [PATCH V2] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
@ 2020-09-29 17:13 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2020-09-29 17:13 UTC (permalink / raw)
To: joro, robdclark, Yu Kuai
Cc: catalin.marinas, kernel-team, Will Deacon, linux-kernel,
yi.zhang, linux-arm-kernel, linux-arm-msm, iommu
On Tue, 29 Sep 2020 09:40:37 +0800, Yu Kuai wrote:
> 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.
Applied to will (for-joerg/arm-smmu/updates), thanks!
[1/1] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
https://git.kernel.org/will/c/e2eae09939a8
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-29 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 1:40 [PATCH V2] iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate() Yu Kuai
2020-09-29 17:13 ` Will Deacon
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).