[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220914051521.10475-1-nicolinc@nvidia.com>
Date: Tue, 13 Sep 2022 22:15:21 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <joro@...tes.org>, <will@...nel.org>, <robin.murphy@....com>,
<heiko@...ech.de>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <iommu@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-rockchip@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH v2 10/13] iommu/rockchip: Constrain return value of ->attach_dev()
Ensure attach_dev() callback functions only return errno values expected
from the attach_dev() op.
Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
---
drivers/iommu/rockchip-iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index ab57c4b8fade..de483b5532ed 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1051,8 +1051,10 @@ static int rk_iommu_attach_device(struct iommu_domain *domain,
return 0;
ret = rk_iommu_enable(iommu);
- if (ret)
+ if (ret) {
rk_iommu_detach_device(iommu->domain, dev);
+ ret = -ENODEV;
+ }
pm_runtime_put(iommu->dev);
--
2.17.1
Powered by blists - more mailing lists