summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-01-07 13:28:51 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-01-07 13:28:51 +0000
commita59f96bb423e2e71d49d49e9c18c7b4286789731 (patch)
treed16915c72a74f6a079e35fbce7d311897f45c4fe
parent0a883e2832fbbb400ea83340c6603ecea40a0ae5 (diff)
Change allocations to M_NOWAIT in attach methods, and return NULL if they fail.
-rw-r--r--sys/dev/wscons/wsemul_sun.c6
-rw-r--r--sys/dev/wscons/wsemul_vt100.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c
index 633b67456c6..a12f8b0a009 100644
--- a/sys/dev/wscons/wsemul_sun.c
+++ b/sys/dev/wscons/wsemul_sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_sun.c,v 1.18 2006/12/02 11:25:09 miod Exp $ */
+/* $OpenBSD: wsemul_sun.c,v 1.19 2007/01/07 13:28:50 miod Exp $ */
/* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */
/*
@@ -216,7 +216,9 @@ wsemul_sun_attach(console, type, cookie, ccol, crow, cbcookie, defattr)
KASSERT(edp->console == 1);
#endif
} else {
- edp = malloc(sizeof *edp, M_DEVBUF, M_WAITOK);
+ edp = malloc(sizeof *edp, M_DEVBUF, M_NOWAIT);
+ if (edp == NULL)
+ return (NULL);
wsemul_sun_init(edp, type, cookie, ccol, crow, defattr);
#ifdef DIAGNOSTIC
diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c
index 78c4ba28e1a..bab482e2a96 100644
--- a/sys/dev/wscons/wsemul_vt100.c
+++ b/sys/dev/wscons/wsemul_vt100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100.c,v 1.15 2006/10/19 17:35:09 dim Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.16 2007/01/07 13:28:50 miod Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
@@ -203,7 +203,9 @@ wsemul_vt100_attach(console, type, cookie, ccol, crow, cbcookie, defattr)
KASSERT(edp->console == 1);
#endif
} else {
- edp = malloc(sizeof *edp, M_DEVBUF, M_WAITOK);
+ edp = malloc(sizeof *edp, M_DEVBUF, M_NOWAIT);
+ if (edp == NULL)
+ return (NULL);
wsemul_vt100_init(edp, type, cookie, ccol, crow, defattr);
#ifdef DIAGNOSTIC
edp->console = 0;