summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-08-09 13:35:44 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-08-09 13:35:44 +0000
commit6b311f3cfec9cdac33236ddb5e9700cc7b431ac4 (patch)
treed66a2932ee4e787522c7020c9b3604303bce33b7 /sys/arch
parent5e1b9f1bb0b5fc792d20b6d1016e8eaaf34d1b62 (diff)
if extent_alloc() fails, we don't clear the iomap properly before
returning an error. so next time we mess around, we may get annoying printfs. Fix this. ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/sg_dma.c10
-rw-r--r--sys/arch/i386/i386/sg_dma.c10
-rw-r--r--sys/arch/sparc64/dev/iommu.c10
-rw-r--r--sys/arch/sparc64/dev/viommu.c10
4 files changed, 28 insertions, 12 deletions
diff --git a/sys/arch/amd64/amd64/sg_dma.c b/sys/arch/amd64/amd64/sg_dma.c
index e60c95dbe99..8faa7865051 100644
--- a/sys/arch/amd64/amd64/sg_dma.c
+++ b/sys/arch/amd64/amd64/sg_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sg_dma.c,v 1.6 2009/07/31 14:30:04 oga Exp $ */
+/* $OpenBSD: sg_dma.c,v 1.7 2009/08/09 13:35:43 oga Exp $ */
/*
* Copyright (c) 2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -277,8 +277,10 @@ sg_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->sg_mtx);
- if (err != 0)
+ if (err != 0) {
+ sg_iomap_clear_pages(spm);
return (err);
+ }
/* Set the active DVMA map */
spm->spm_start = dvmaddr;
@@ -571,8 +573,10 @@ sg_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->sg_mtx);
- if (err != 0)
+ if (err != 0) {
+ sg_iomap_clear_pages(spm);
return (err);
+ }
/* Set the active DVMA map */
spm->spm_start = dvmaddr;
diff --git a/sys/arch/i386/i386/sg_dma.c b/sys/arch/i386/i386/sg_dma.c
index 615dcb46df8..0ec2b4c35ad 100644
--- a/sys/arch/i386/i386/sg_dma.c
+++ b/sys/arch/i386/i386/sg_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sg_dma.c,v 1.3 2009/07/31 14:30:04 oga Exp $ */
+/* $OpenBSD: sg_dma.c,v 1.4 2009/08/09 13:35:43 oga Exp $ */
/*
* Copyright (c) 2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -277,8 +277,10 @@ sg_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
sgsize, align, 0, (sgsize > boundary) ? 0 : boundary,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->sg_mtx);
- if (err != 0)
+ if (err != 0) {
+ sg_iomap_clear_pages(spm);
return (err);
+ }
/* Set the active DVMA map */
spm->spm_start = dvmaddr;
@@ -554,8 +556,10 @@ sg_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->sg_mtx);
- if (err != 0)
+ if (err != 0) {
+ sg_iomap_clear_pages(spm);
return (err);
+ }
/* Set the active DVMA map */
spm->spm_start = dvmaddr;
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index 850e086aa21..889486ebdd2 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.60 2009/05/04 16:48:37 oga Exp $ */
+/* $OpenBSD: iommu.c,v 1.61 2009/08/09 13:35:43 oga Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -760,8 +760,10 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
#endif
}
#endif
- if (err != 0)
+ if (err != 0) {
+ iommu_iomap_clear_pages(ims);
return (err);
+ }
/* Set the active DVMA map */
map->_dm_dvmastart = dvmaddr;
@@ -958,8 +960,10 @@ iommu_dvmamap_load_raw(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
- if (err != 0)
+ if (err != 0) {
+ iommu_iomap_clear_pages(ims);
return (err);
+ }
#ifdef DEBUG
if (dvmaddr == (bus_addr_t)-1) {
diff --git a/sys/arch/sparc64/dev/viommu.c b/sys/arch/sparc64/dev/viommu.c
index b1d34106af2..88e09dae6f7 100644
--- a/sys/arch/sparc64/dev/viommu.c
+++ b/sys/arch/sparc64/dev/viommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viommu.c,v 1.7 2009/05/04 16:48:37 oga Exp $ */
+/* $OpenBSD: viommu.c,v 1.8 2009/08/09 13:35:43 oga Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -373,8 +373,10 @@ viommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
#endif
}
#endif
- if (err != 0)
+ if (err != 0) {
+ iommu_iomap_clear_pages(ims);
return (err);
+ }
/* Set the active DVMA map */
map->_dm_dvmastart = dvmaddr;
@@ -547,8 +549,10 @@ viommu_dvmamap_load_raw(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
EX_NOWAIT | EX_BOUNDZERO, (u_long *)&dvmaddr);
mtx_leave(&is->is_mtx);
- if (err != 0)
+ if (err != 0) {
+ iommu_iomap_clear_pages(ims);
return (err);
+ }
#ifdef DEBUG
if (dvmaddr == (bus_addr_t)-1) {