diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index d721d64a98580..0cdda7e07af71 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -324,7 +324,7 @@ static void amba_shutdown(struct device *dev) static int amba_dma_configure(struct device *dev) { - struct amba_driver *drv = to_amba_driver(dev->driver); + const struct device_driver *drv = READ_ONCE(dev->driver); enum dev_dma_attr attr; int ret = 0; @@ -336,7 +336,7 @@ static int amba_dma_configure(struct device *dev) } /* @drv may not be valid when we're called from the IOMMU layer */ - if (!ret && dev->driver && !drv->driver_managed_dma) { + if (!ret && drv && !to_amba_driver(drv)->driver_managed_dma) { ret = iommu_device_use_default_domain(dev); if (ret) arch_teardown_dma_ops(dev);