OpenBSD/arm seems to be the only port that doesn't like it when you
pass its bus_dmamap_sync() a size of zero.  While it is indeed a bit
silly to do so, adding checks for this in the drivers might be
overkill.  In fact if you read the bus_dma_sync(9) man page, you could
could interpret from

     On platforms which implement reordered stores, bus_dmamap_sync() will
     always cause the store buffer to be flushed.

that passing a size of zero is useful to flush the store buffers.

So my idea is that we simply remove the check.

ok?


Index: arch/arm/arm/bus_dma.c
===================================================================
RCS file: /cvs/src/sys/arch/arm/arm/bus_dma.c,v
retrieving revision 1.30
diff -u -p -r1.30 bus_dma.c
--- arch/arm/arm/bus_dma.c      16 May 2016 15:13:50 -0000      1.30
+++ arch/arm/arm/bus_dma.c      13 Aug 2016 19:45:52 -0000
@@ -589,7 +589,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
        if (offset >= map->dm_mapsize)
                panic("_bus_dmamap_sync: bad offset %lu (map size is %lu)",
                    offset, map->dm_mapsize);
-       if (len == 0 || (offset + len) > map->dm_mapsize)
+       if ((offset + len) > map->dm_mapsize)
                panic("_bus_dmamap_sync: bad length");
 #endif
 

Reply via email to