From: Simon Date: Fri, 25 Mar 2016 08:31:37 +0000 (+0800) Subject: iommu/rockchip: add more judgement for virtual device who using iommu X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d8e3c63e3054ce6b7994f38d010567d235024724;p=firefly-linux-kernel-4.4.55.git iommu/rockchip: add more judgement for virtual device who using iommu A virtual device like "drm" call iommu_attach_device may fail. Current only judge if a device has "group", this is not enough, "group->iommu_data" is needed Change-Id: I1a66d6016dfef867d83aa4cccaf223ced4e07161 Signed-off-by: Simon --- diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 044c5685b115..e9db6badd5cb 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -772,6 +772,11 @@ static struct rk_iommu *rk_iommu_from_dev(struct device *dev) if (!group) return NULL; iommu_dev = iommu_group_get_iommudata(group); + if (!iommu_dev) { + dev_info(dev, "Possibly a virtual device\n"); + return NULL; + } + rk_iommu = dev_get_drvdata(iommu_dev); iommu_group_put(group);