summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2005-03-30 22:28:01 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2005-03-30 22:28:01 +0000
commit9b9ea582b16d5015196bb4731aa5d48ae0f1c04e (patch)
treeac717e4bd265b7e29f58eb0c46f9ee8866993a1a
parent0cfbabe55ba30755f8f5b9e6c13ee7831d8ddab7 (diff)
init pool after we allocate softc array in case malloc fails
-rw-r--r--sys/dev/ccd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 8a5735922c7..ef15ea0894f 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.58 2005/03/25 17:51:16 mickey Exp $ */
+/* $OpenBSD: ccd.c,v 1.59 2005/03/30 22:28:00 mickey Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -249,12 +249,6 @@ ccdattach(num)
return;
}
- ccdbufsizeof = sizeof(struct ccdbuf) +
- (CCD_SGMAX - 1) * sizeof(struct ccdseg);
- pool_init(&ccdbufpl, ccdbufsizeof, 0, 0, 0, "ccdbufpl", NULL);
- pool_setlowat(&ccdbufpl, 16);
- pool_sethiwat(&ccdbufpl, 1024);
-
ccd_softc = (struct ccd_softc *)malloc(num * sizeof(struct ccd_softc),
M_DEVBUF, M_NOWAIT);
ccddevs = (struct ccddevice *)malloc(num * sizeof(struct ccddevice),
@@ -270,6 +264,12 @@ ccdattach(num)
numccd = num;
bzero(ccd_softc, num * sizeof(struct ccd_softc));
bzero(ccddevs, num * sizeof(struct ccddevice));
+
+ ccdbufsizeof = sizeof(struct ccdbuf) +
+ (CCD_SGMAX - 1) * sizeof(struct ccdseg);
+ pool_init(&ccdbufpl, ccdbufsizeof, 0, 0, 0, "ccdbufpl", NULL);
+ pool_setlowat(&ccdbufpl, 16);
+ pool_sethiwat(&ccdbufpl, 1024);
}
int