diff options
| author | tsutsui <tsutsui@NetBSD.org> | 2006-04-19 17:44:07 +0000 |
|---|---|---|
| committer | tsutsui <tsutsui@NetBSD.org> | 2006-04-19 17:44:07 +0000 |
| commit | 91174570f26bbff034c71dbee69bb00d8af2a0dd (patch) | |
| tree | 2feeb91331af0a956ae9019cea591afe58dadad3 | |
| parent | 29f4f9865a6944b4df0e587c9fc2dfbcf1489a47 (diff) | |
- use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
in zstty_attach()
- check a return value of the malloc(9)
Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.
| -rw-r--r-- | sys/dev/ic/z8530tty.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 93eccf1ee06..435926b5448 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530tty.c,v 1.105 2006/03/29 04:16:49 thorpej Exp $ */ +/* $NetBSD: z8530tty.c,v 1.106 2006/04/19 17:44:07 tsutsui Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -137,7 +137,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.105 2006/03/29 04:16:49 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.106 2006/04/19 17:44:07 tsutsui Exp $"); #include "opt_kgdb.h" #include "opt_ntp.h" @@ -410,7 +410,12 @@ zstty_attach(parent, self, aux) tty_attach(tp); zst->zst_tty = tp; - zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK); + zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT); + if (zst->zst_rbuf == NULL) { + aprint_error("%s: unable to allocate ring buffer\n", + zst->zst_dev.dv_xname); + return; + } zst->zst_ebuf = zst->zst_rbuf + (zstty_rbuf_size << 1); /* Disable the high water mark. */ zst->zst_r_hiwat = 0; |
