Skip to content

Commit

Permalink
iommu/of: Fix probe-deferral
Browse files Browse the repository at this point in the history
Whilst iommu_probe_device() does check for non-NULL ops as the previous
code did, it does not do so in the same order relative to the other
checks, and as a result means that -EPROBE_DEFER returned by of_xlate()
(plus any real error condition too) gets overwritten with -EINVAL and
leads to various misbehaviour.

Reinstate the original logic, but without implicitly relying on ops
being set to infer !err as the initial condition (now that the validity
of ops for its own sake is checked elsewhere).

Fixes: 641fb0e ("iommu/of: Don't call iommu_ops->add_device directly")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
rmurphy-arm authored and joergroedel committed Jan 11, 2019
1 parent bfeffd1 commit e8e683a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iommu/of_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev,
* If we have reason to believe the IOMMU driver missed the initial
* probe for dev, replay it to get things in order.
*/
if (dev->bus && !device_iommu_mapped(dev))
if (!err && dev->bus && !device_iommu_mapped(dev))
err = iommu_probe_device(dev);

/* Ignore all other errors apart from EPROBE_DEFER */
Expand Down

0 comments on commit e8e683a

Please sign in to comment.