diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-05-02 18:39:28 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-05-02 18:39:28 +0000 |
commit | 23afab51bc73a7d739f5b78a9932172ac5e6295e (patch) | |
tree | 12e28d723a32a4d66cb9e539925c98ef45e36e22 /sys/arch/sparc64 | |
parent | 0b4c32b0df28d0cee128a23f24d0376399e2d791 (diff) |
Avoid clobbering error return values with the result from extent_free(), by
simply calling iommu_dvma_unload(). Solution suggested by oga@.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/dev/iommu.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c index 40f4c81e304..be92ad98c45 100644 --- a/sys/arch/sparc64/dev/iommu.c +++ b/sys/arch/sparc64/dev/iommu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iommu.c,v 1.57 2009/04/14 16:01:04 oga Exp $ */ +/* $OpenBSD: iommu.c,v 1.58 2009/05/02 18:39:27 kettenis Exp $ */ /* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */ /* @@ -830,18 +830,8 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map, #endif } #endif - if (err) { - /* XXX keep enough state and just call unload here? */ - iommu_iomap_unload_map(is, ims); - iommu_iomap_clear_pages(ims); - map->dm_mapsize = 0; - map->dm_nsegs = 0; - mtx_enter(&is->is_mtx); - err = extent_free(is->is_dvmamap, dvmaddr, sgsize, EX_NOWAIT); - map->_dm_dvmastart = 0; - map->_dm_dvmasize = 0; - mtx_leave(&is->is_mtx); - } + if (err) + iommu_dvmamap_unload(t, t0, map); return (err); } @@ -1050,18 +1040,8 @@ iommu_dvmamap_load_raw(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map, #endif } #endif - if (err) { - /* XXX keep enough state and just call unload here? */ - iommu_iomap_unload_map(is, ims); - iommu_iomap_clear_pages(ims); - map->dm_mapsize = 0; - map->dm_nsegs = 0; - mtx_enter(&is->is_mtx); - err = extent_free(is->is_dvmamap, dvmaddr, sgsize, EX_NOWAIT); - map->_dm_dvmastart = 0; - map->_dm_dvmasize = 0; - mtx_leave(&is->is_mtx); - } + if (err) + iommu_dvmamap_unload(t, t0, map); return (err); } |