On Tue, Aug 23, 2016 at 08:05:26PM +0100, Robin Murphy wrote:
In the final step of preparation for full generic configuration support,
swap our fixed-size master_cfg for the generic iommu_fwspec. For the
legacy DT bindings, the driver simply gets to act as its own 'firmware'.
Farewell, arbitrary MAX_MASTER_STREAMIDS!
Signed-off-by: Robin Murphy <redacted>
---
drivers/iommu/arm-smmu.c | 139 ++++++++++++++++++++++++++---------------------
1 file changed, 77 insertions(+), 62 deletions(-)
[...]
static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
{
int ret;
+ struct iommu_fwspec *fwspec = dev_iommu_fwspec(dev);
+ struct arm_smmu_device *smmu = fwspec_smmu(fwspec);
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
- struct arm_smmu_master_cfg *cfg = dev->archdata.iommu;
- if (!cfg) {
+ if (!fwspec || fwspec->iommu_ops != &arm_smmu_ops) {
As mentioned off-list, you have already dereferenced fwspec before this
NULL check.
Will