summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/isa/isadma_bounce.c5
-rw-r--r--sys/arch/amd64/isa/isa_machdep.c5
-rw-r--r--sys/arch/i386/isa/isa_machdep.c5
-rw-r--r--sys/arch/sgi/xbow/xbridge.c16
-rw-r--r--sys/arch/zaurus/dev/zaurus_flash.c12
5 files changed, 18 insertions, 25 deletions
diff --git a/sys/arch/alpha/isa/isadma_bounce.c b/sys/arch/alpha/isa/isadma_bounce.c
index e4cb07fdd71..4f1ca9a23e2 100644
--- a/sys/arch/alpha/isa/isadma_bounce.c
+++ b/sys/arch/alpha/isa/isadma_bounce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isadma_bounce.c,v 1.11 2014/07/12 18:44:40 tedu Exp $ */
+/* $OpenBSD: isadma_bounce.c,v 1.12 2015/09/27 10:12:09 semarie Exp $ */
/* $NetBSD: isadma_bounce.c,v 1.3 2000/06/29 09:02:57 mrg Exp $ */
/*-
@@ -170,8 +170,7 @@ isadma_bounce_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
out:
if (error) {
- if (map->_dm_cookie != NULL)
- free(map->_dm_cookie, M_DEVBUF, 0);
+ free(map->_dm_cookie, M_DEVBUF, cookiesize);
_bus_dmamap_destroy(t, map);
}
return (error);
diff --git a/sys/arch/amd64/isa/isa_machdep.c b/sys/arch/amd64/isa/isa_machdep.c
index b79d5aa6b51..74dc90762e5 100644
--- a/sys/arch/amd64/isa/isa_machdep.c
+++ b/sys/arch/amd64/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.27 2015/03/14 03:38:46 jsg Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.28 2015/09/27 10:12:09 semarie Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
#define ISA_DMA_STATS
@@ -451,8 +451,7 @@ _isa_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
out:
if (error) {
- if (map->_dm_cookie != NULL)
- free(map->_dm_cookie, M_DEVBUF, 0);
+ free(map->_dm_cookie, M_DEVBUF, cookiesize);
_bus_dmamap_destroy(t, map);
}
return (error);
diff --git a/sys/arch/i386/isa/isa_machdep.c b/sys/arch/i386/isa/isa_machdep.c
index b52b56e9fe7..db6cb7150f7 100644
--- a/sys/arch/i386/isa/isa_machdep.c
+++ b/sys/arch/i386/isa/isa_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.c,v 1.81 2015/09/01 06:01:26 deraadt Exp $ */
+/* $OpenBSD: isa_machdep.c,v 1.82 2015/09/27 10:12:09 semarie Exp $ */
/* $NetBSD: isa_machdep.c,v 1.22 1997/06/12 23:57:32 thorpej Exp $ */
/*-
@@ -715,8 +715,7 @@ _isa_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
out:
if (error) {
- if (map->_dm_cookie != NULL)
- free(map->_dm_cookie, M_DEVBUF, 0);
+ free(map->_dm_cookie, M_DEVBUF, cookiesize);
_bus_dmamap_destroy(t, map);
}
return (error);
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index 046e34a56f4..7e92d9354b9 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.98 2015/09/12 08:40:02 miod Exp $ */
+/* $OpenBSD: xbridge.c,v 1.99 2015/09/27 10:12:09 semarie Exp $ */
/*
* Copyright (c) 2008, 2009, 2011 Miodrag Vallat.
@@ -884,14 +884,12 @@ xbpci_attach(struct device *parent, struct device *self, void *aux)
fail2:
free(xb->xb_dmat, M_DEVBUF, 0);
fail1:
- if (xb->xb_io_bus_space_sw != NULL)
- free(xb->xb_io_bus_space_sw, M_DEVBUF, 0);
- if (xb->xb_io_bus_space != NULL)
- free(xb->xb_io_bus_space, M_DEVBUF, 0);
- if (xb->xb_mem_bus_space_sw != NULL)
- free(xb->xb_mem_bus_space_sw, M_DEVBUF, 0);
- if (xb->xb_mem_bus_space != NULL)
- free(xb->xb_mem_bus_space, M_DEVBUF, 0);
+ free(xb->xb_io_bus_space_sw, M_DEVBUF,
+ sizeof (*xb->xb_io_bus_space_sw));
+ free(xb->xb_io_bus_space, M_DEVBUF, sizeof (*xb->xb_io_bus_space));
+ free(xb->xb_mem_bus_space_sw, M_DEVBUF,
+ sizeof (*xb->xb_mem_bus_space_sw));
+ free(xb->xb_mem_bus_space, M_DEVBUF, sizeof (*xb->xb_mem_bus_space));
if (errmsg == NULL)
errmsg = "not enough memory to build bus access structures";
printf("%s\n", errmsg);
diff --git a/sys/arch/zaurus/dev/zaurus_flash.c b/sys/arch/zaurus/dev/zaurus_flash.c
index 1a474642718..32a12999e90 100644
--- a/sys/arch/zaurus/dev/zaurus_flash.c
+++ b/sys/arch/zaurus/dev/zaurus_flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_flash.c,v 1.13 2014/07/12 18:44:43 tedu Exp $ */
+/* $OpenBSD: zaurus_flash.c,v 1.14 2015/09/27 10:12:09 semarie Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -583,15 +583,13 @@ zflash_write_strategy(struct zflash_softc *sc, struct buf *bp,
}
bp->b_resid = bp->b_bcount - sc->sc_flash.sc_flashdev->pagesize;
- free(oob, M_DEVBUF, 0);
- free(buf, M_DEVBUF, 0);
+ free(oob, M_DEVBUF, oobsize);
+ free(buf, M_DEVBUF, bufsize);
return;
bad:
bp->b_flags |= B_ERROR;
- if (oob != NULL)
- free(oob, M_DEVBUF, 0);
- if (buf != NULL)
- free(buf, M_DEVBUF, 0);
+ free(oob, M_DEVBUF, oobsize);
+ free(buf, M_DEVBUF, bufsize);
}
int