On 02/08/18 13:43, Christoph Hellwig wrote:
On Thu, Aug 02, 2018 at 01:32:17PM +0100, Robin Murphy wrote:
On 02/08/18 13:13, Christoph Hellwig wrote:
Returning NULL from get_arch_dma_ops makes all DMA mapping routines
retourn sensible errors, so remove the dummy ops.

Does it? AFAICS all of the non-optional callbacks will still either
BUG_ON(!ops) or blindly dereference the null pointer. Have I lost track of
another cleanup patch somewhere?

First thing any driver needs to do is dma_set_mask, which first calls
dma_supported:

static inline int dma_supported(struct device *dev, u64 mask)
{
         const struct dma_map_ops *ops = get_dma_ops(dev);

        if (!ops)
                return 0;
        ...
}


Yeah, apart from all the drivers that don't. After last week's fun I'm not putting any reliance in that assumption ;)

Of course, the combination of a cheeky legacy driver assuming 32-bit DMA *and* busted firmware failing to describe that device properly should be rare enough that this change is almost certainly a non-issue in practice, but I'm still never going to say I love it.

Robin.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to