summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-16 19:14:04 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-05-16 19:14:04 +0000
commit39fe5918c0371535032ed7078a6c405be96d7141 (patch)
tree79524f2e4b27b13ca57291b831dde304a09d30de
parent721e2f80a69d861a4d47cc267f1f6fb73b21f234 (diff)
call malloc w/ NOWAIT and check for NULL return
-rw-r--r--sys/dev/ic/ac97.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c
index 57e0a4dd01c..d4c0cd06089 100644
--- a/sys/dev/ic/ac97.c
+++ b/sys/dev/ic/ac97.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ac97.c,v 1.17 2001/05/16 12:51:48 ho Exp $ */
+/* $OpenBSD: ac97.c,v 1.18 2001/05/16 19:14:03 mickey Exp $ */
/*
* Copyright (c) 1999, 2000 Constantine Sapuntzakis
@@ -582,7 +582,9 @@ ac97_attach(host_if)
mixer_ctrl_t ctl;
int error, i;
- as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_WAITOK);
+ if (!(as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_NOWAIT)))
+ return (ENOMEM);
+
bzero(as, sizeof(*as));
as->codec_if.vtbl = &ac97civ;