iommu/sprd: Constrain return value of ->attach_dev()
Subsystems (2)
PATCH v2 11/13 iommu/sprd: Constrain return value of ->attach_dev()
Ensure attach_dev() callback functions only return errno values expected from the attach_dev() op. In particular, only return -EINVAL when we are sure that the device is incompatible with the domain.
Also drop any dev_err next to -EINVAL, following the attach_dev op kdocs.
Signed-off-by Nicolin Chen <[email protected]>
--- drivers/iommu/sprd-iommu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iommu/sprd-iommu.c +1 -3
@@ -237,10 +237,8 @@ static int sprd_iommu_attach_device(struct iommu_domain *domain,struct sprd_iommu_domain *dom =to_sprd_domain (domain);size_t pgt_size =sprd_iommu_pgt_size (domain); -if (dom->sdev) { -pr_err ("There's already a device attached to this domain.\n" ); +if (dom->sdev)return -EINVAL ; - } dom->pgt_va =dma_alloc_coherent (sdev->dev, pgt_size, &dom->pgt_pa,GFP_KERNEL );if (!dom->pgt_va)
Signature · 1 line
2.17.1