diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 2001-05-16 12:50:22 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 2001-05-16 12:50:22 +0000 |
commit | a1ba5f046489f61451990b86f39a64f15b7a177a (patch) | |
tree | 592ed6a3cf10a0b29b117e9b3506d9e32bf50813 /sys/arch | |
parent | 885c6fa9e2c5dae9c5fbc277bc5b7018e4d78ac8 (diff) |
No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amiga/dev/view.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ext.c | 17 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_kbd.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_out.c | 30 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_sup.c | 19 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 5 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/flash.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/vs.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vs.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/isp_sbus.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc/dev/magma.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/clock.c | 6 | ||||
-rw-r--r-- | sys/arch/sun3/dev/eeprom.c | 9 | ||||
-rw-r--r-- | sys/arch/sun3/dev/si.c | 4 |
15 files changed, 35 insertions, 107 deletions
diff --git a/sys/arch/amiga/dev/view.c b/sys/arch/amiga/dev/view.c index 83cba6231c5..bc29ae7b157 100644 --- a/sys/arch/amiga/dev/view.c +++ b/sys/arch/amiga/dev/view.c @@ -1,4 +1,4 @@ -/* $OpenBSD: view.c,v 1.3 1997/01/16 09:25:30 niklas Exp $ */ +/* $OpenBSD: view.c,v 1.4 2001/05/16 12:49:44 ho Exp $ */ /* $NetBSD: view.c,v 1.16 1996/10/13 03:07:35 christos Exp $ */ /* @@ -350,8 +350,6 @@ view_get_colormap (vu, ucm) /* add one incase of zero, ick. */ cme = malloc(sizeof (u_long)*(ucm->size + 1), M_IOCTLOPS, M_WAITOK); - if (cme == NULL) - return(ENOMEM); uep = ucm->entry; error = 0; @@ -376,8 +374,6 @@ view_set_colormap(vu, ucm) error = 0; cm = malloc(sizeof(u_long) * ucm->size + sizeof (*cm), M_IOCTLOPS, M_WAITOK); - if (cm == NULL) - return(ENOMEM); bcopy (ucm, cm, sizeof(colormap_t)); cm->entry = (u_long *)&cm[1]; /* table directly after. */ diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index cce3eed5ca1..795ef3def75 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ext.c +++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_ext.c,v 1.30 2001/05/16 05:07:48 millert Exp $ */ +/* $OpenBSD: pcvt_ext.c,v 1.31 2001/05/16 12:49:45 ho Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. * @@ -1125,16 +1125,11 @@ wd90c11_col(int cols) { if(vgacs[i].loaded) { - if((sv_fontwd[i] = - (u_char *)malloc(32 * 256, - M_DEVBUF, - M_WAITOK)) - == NULL) - printf("pcvt: no font buffer\n"); - else - vga_move_charset(i, - sv_fontwd[i], - 1); + sv_fontwd[i] = + (u_char *)malloc(32 * 256, + M_DEVBUF, + M_WAITOK); + vga_move_charset(i, sv_fontwd[i], 1); } else { diff --git a/sys/arch/i386/isa/pcvt/pcvt_kbd.c b/sys/arch/i386/isa/pcvt/pcvt_kbd.c index deb157f6bc2..c570dc29ea4 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/arch/i386/isa/pcvt/pcvt_kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_kbd.c,v 1.40 2001/01/22 18:48:43 deraadt Exp $ */ +/* $OpenBSD: pcvt_kbd.c,v 1.41 2001/05/16 12:49:45 ho Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -629,10 +629,9 @@ void ovlinit(int force) int i; if (force || ovlinitflag == 0) { - if (ovlinitflag == 0 && - (ovltbl = (Ovl_tbl *)malloc(sizeof(Ovl_tbl) * OVLTBL_SIZE, - M_DEVBUF, M_WAITOK)) == NULL) - panic("pcvt_kbd: malloc of Ovl_tbl failed"); + if (ovlinitflag == 0) + ovltbl = (Ovl_tbl *)malloc(sizeof(Ovl_tbl) * OVLTBL_SIZE, + M_DEVBUF, M_WAITOK); for(i = 0; i < OVLTBL_SIZE; i++) { ovltbl[i].keynum = diff --git a/sys/arch/i386/isa/pcvt/pcvt_out.c b/sys/arch/i386/isa/pcvt/pcvt_out.c index 8a8a23cfc80..d4a9556a7f0 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_out.c +++ b/sys/arch/i386/isa/pcvt/pcvt_out.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_out.c,v 1.30 2001/01/22 18:48:44 deraadt Exp $ */ +/* $OpenBSD: pcvt_out.c,v 1.31 2001/05/16 12:49:45 ho Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1261,12 +1261,9 @@ vt_coldmalloc(void) } scrollback_pages = SCROLLBACK_PAGES; - if ((Scrollbuffer = (u_short *)malloc(vs[0].maxcol * - vs[0].screen_rows * scrollback_pages * CHR, M_DEVBUF, - M_WAITOK)) == NULL) - { - printf("pcvt: scrollback memory malloc failed\n"); - } + Scrollbuffer = (u_short *)malloc(vs[0].maxcol * vs[0].screen_rows * + scrollback_pages * CHR, M_DEVBUF, + M_WAITOK); /* * Copy buffer must be 1 character wider than the screen because we @@ -1274,24 +1271,13 @@ vt_coldmalloc(void) */ Copybuffer_size = (vs[0].maxcol + 1) * vs[0].screen_rows; - if ((Copybuffer = (char *)malloc(Copybuffer_size, M_DEVBUF, M_WAITOK)) - == NULL) - { - printf("pcvt: copy memory malloc failed\n"); - Copybuffer_size = 0; - } + Copybuffer = (char *)malloc(Copybuffer_size, M_DEVBUF, M_WAITOK); for(nscr = 0; nscr < PCVT_NSCREENS; nscr++) { - if((vs[nscr].Memory = - (u_short *)malloc(screen_max_size * 2, M_DEVBUF, M_WAITOK)) - == NULL) - { - printf("pcvt: screen memory malloc failed, " - "NSCREEN=%d, nscr=%d\n", - PCVT_NSCREENS, nscr); - break; - } + vs[nscr].Memory = + (u_short *)malloc(screen_max_size * 2, M_DEVBUF, M_WAITOK); + vs[nscr].Scrollback = Scrollbuffer; if(nscr != 0) { diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index 5c94032a94a..5c96ae69c12 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_sup.c +++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_sup.c,v 1.17 2000/09/28 17:45:42 aaron Exp $ */ +/* $OpenBSD: pcvt_sup.c,v 1.18 2001/05/16 12:49:46 ho Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1356,18 +1356,11 @@ loadchar(int fontset, int character, int char_scanlines, u_char *char_table) saved_charsets[fontset] = (u_char *)malloc(32 * 256, M_DEVBUF, M_WAITOK); - if((bak = saved_charsets[fontset])) - { - /* make a backup copy of this char */ - bak += (character * 32); - bzero(bak, 32); - bcopy(char_table, bak, char_scanlines); - } -#ifdef DIAGNOSTIC - else - panic("pcvt loadchar: no backup buffer"); -#endif /* DIAGNOSTIC */ - + bak = saved_charsets[fontset]; + /* make a backup copy of this char */ + bak += (character * 32); + bzero(bak, 32); + bcopy(char_table, bak, char_scanlines); #endif /* PCVT_BACKUP_FONTS */ } diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index 649512bde69..31498f76d61 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -132,11 +132,6 @@ snsetup(sc, lladdr) * to do that? */ sc->space = malloc((SN_NPAGES + 1) * NBPG, M_DEVBUF, M_WAITOK); - if (sc->space == NULL) { - printf ("%s: memory allocation for descriptors failed\n", - sc->sc_dev.dv_xname); - return (1); - } /* * Put the pup in reset mode (sninit() will fix it later), diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c index 38817227130..3bafb882bea 100644 --- a/sys/arch/mvme68k/dev/flash.c +++ b/sys/arch/mvme68k/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.7 2000/03/26 23:31:59 deraadt Exp $ */ +/* $OpenBSD: flash.c,v 1.8 2001/05/16 12:49:46 ho Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -207,8 +207,6 @@ flashsavezone(sc, start) u_char *zone; zone = (u_char *)malloc(sc->sc_zonesize, M_TEMP, M_WAITOK); - if (!zone) - return (NULL); sc->sc_vaddr[0] = FLCMD_RESET; bcopy((u_char *)&sc->sc_vaddr[start], zone, sc->sc_zonesize); return (zone); @@ -394,8 +392,6 @@ flashwrite(dev, uio, flags) int zonestart, zoneoff; cmpbuf = (u_char *)malloc(sc->sc_zonesize, M_TEMP, M_WAITOK); - if (!cmpbuf) - return (ENOMEM); while (uio->uio_resid > 0 && error == 0) { iov = uio->uio_iov; diff --git a/sys/arch/mvme68k/dev/vs.c b/sys/arch/mvme68k/dev/vs.c index 933ea6b5820..068010195ac 100644 --- a/sys/arch/mvme68k/dev/vs.c +++ b/sys/arch/mvme68k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.2 2000/06/10 19:53:23 deraadt Exp $ */ +/* $OpenBSD: vs.c,v 1.3 2001/05/16 12:49:47 ho Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -839,10 +839,6 @@ vs_alloc_scatter_gather(void) M328_SG sg; MALLOC(sg, M328_SG, sizeof(struct m328_sg), M_DEVBUF, M_WAITOK); - assert ( sg ); - if ( !sg ) { - panic ("Memory for scatter_gather_list not available"); - } bzero(sg, sizeof(struct m328_sg)); return (sg); diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index 51587ba9aa7..da71e0ef0ca 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.5 2001/03/09 05:44:39 smurph Exp $ */ +/* $OpenBSD: vs.c,v 1.6 2001/05/16 12:49:47 ho Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -927,10 +927,6 @@ vs_alloc_scatter_gather(void) M328_SG sg; MALLOC(sg, M328_SG, sizeof(struct m328_sg), M_DEVBUF, M_WAITOK); - assert ( sg ); - if ( !sg ) { - panic ("Memory for scatter_gather_list not available"); - } bzero(sg, sizeof(struct m328_sg)); return (sg); diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index c7798c630b7..6bf3e432933 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.26 2001/05/09 15:31:25 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.27 2001/05/16 12:49:47 ho Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -1674,9 +1674,6 @@ pmap_create(vm_size_t size) CHECK_PMAP_CONSISTENCY("pmap_create"); p = (pmap_t)malloc(sizeof(*p), M_VMPMAP, M_WAITOK); - if (p == PMAP_NULL) { - panic("pmap_create: cannot allocate a pmap"); - } bzero(p, sizeof(*p)); pmap_pinit(p); diff --git a/sys/arch/sparc/dev/isp_sbus.c b/sys/arch/sparc/dev/isp_sbus.c index 6f52ca6f6be..ccbe0d68712 100644 --- a/sys/arch/sparc/dev/isp_sbus.c +++ b/sys/arch/sparc/dev/isp_sbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_sbus.c,v 1.16 2001/04/04 22:06:22 mjacob Exp $ */ +/* $OpenBSD: isp_sbus.c,v 1.17 2001/05/16 12:49:48 ho Exp $ */ /* * SBus specific probe and attach routines for Qlogic ISP SCSI adapters. * @@ -302,17 +302,9 @@ isp_sbus_mbxdma(struct ispsoftc *isp) len = isp->isp_maxcmds * sizeof (XS_T); isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK); - if (isp->isp_xflist == NULL) { - printf("%s: cannot malloc xflist array\n", isp->isp_name); - return (1); - } bzero(isp->isp_xflist, len); len = isp->isp_maxcmds * sizeof (vaddr_t); sbc->sbus_kdma_allocs = (vaddr_t *) malloc(len, M_DEVBUF, M_WAITOK); - if (sbc->sbus_kdma_allocs == NULL) { - printf("%s: cannot malloc sbus_kdma_allocs\n", isp->isp_name); - return (1); - } bzero(sbc->sbus_kdma_allocs, len); /* diff --git a/sys/arch/sparc/dev/magma.c b/sys/arch/sparc/dev/magma.c index dca22b6734c..5571f99a977 100644 --- a/sys/arch/sparc/dev/magma.c +++ b/sys/arch/sparc/dev/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.7 2001/03/24 10:07:19 ho Exp $ */ +/* $OpenBSD: magma.c,v 1.8 2001/05/16 12:49:48 ho Exp $ */ /* * magma.c * @@ -1591,8 +1591,6 @@ int gotdata = 0; buflen = min(uio->uio_resid, mp->mp_burst); buffer = malloc(buflen, M_DEVBUF, M_WAITOK); - if( buffer == NULL ) - return(ENOMEM); SET(mp->mp_flags, MBPPF_UIO); diff --git a/sys/arch/sparc/sparc/clock.c b/sys/arch/sparc/sparc/clock.c index dbf34309535..e84b775060e 100644 --- a/sys/arch/sparc/sparc/clock.c +++ b/sys/arch/sparc/sparc/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.13 1999/09/29 13:54:03 art Exp $ */ +/* $OpenBSD: clock.c,v 1.14 2001/05/16 12:49:48 ho Exp $ */ /* $NetBSD: clock.c,v 1.52 1997/05/24 20:16:05 pk Exp $ */ /* @@ -1261,10 +1261,6 @@ eeprom_uio(uio) * temporary buffer. */ buf = malloc(EEPROM_SIZE, M_DEVBUF, M_WAITOK); - if (buf == NULL) { - error = EAGAIN; - goto out; - } if (uio->uio_rw == UIO_READ) for (bcnt = 0; bcnt < EEPROM_SIZE; ++bcnt) diff --git a/sys/arch/sun3/dev/eeprom.c b/sys/arch/sun3/dev/eeprom.c index d4e36dff344..61672907da6 100644 --- a/sys/arch/sun3/dev/eeprom.c +++ b/sys/arch/sun3/dev/eeprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eeprom.c,v 1.7 2001/01/04 22:34:42 miod Exp $ */ +/* $OpenBSD: eeprom.c,v 1.8 2001/05/16 12:49:48 ho Exp $ */ /* $NetBSD: eeprom.c,v 1.8 1996/03/26 15:16:06 gwr Exp $ */ /* @@ -175,12 +175,7 @@ eeprom_uio(uio) va = eeprom_va; if (uio->uio_rw != UIO_READ) { /* Write requires a temporary buffer. */ - buf = malloc(OBIO_EEPROM_SIZE, M_DEVBUF, M_WAITOK); - if (!buf) { - error = EAGAIN; - goto out; - } - va = buf; + va = buf = malloc(OBIO_EEPROM_SIZE, M_DEVBUF, M_WAITOK); } if ((error = uiomove(va + off, (int)cnt, uio)) != 0) diff --git a/sys/arch/sun3/dev/si.c b/sys/arch/sun3/dev/si.c index 5c573989874..917e3167cd2 100644 --- a/sys/arch/sun3/dev/si.c +++ b/sys/arch/sun3/dev/si.c @@ -1,4 +1,4 @@ -/* $OpenBSD: si.c,v 1.13 2000/09/21 21:25:16 miod Exp $ */ +/* $OpenBSD: si.c,v 1.14 2001/05/16 12:49:49 ho Exp $ */ /* $NetBSD: si.c,v 1.31 1996/11/20 18:56:59 gwr Exp $ */ /*- @@ -203,8 +203,6 @@ si_attach(sc) i = SCI_OPENINGS * sizeof(struct si_dma_handle); sc->sc_dma = (struct si_dma_handle *) malloc(i, M_DEVBUF, M_WAITOK); - if (sc->sc_dma == NULL) - panic("si: dvma_malloc failed"); for (i = 0; i < SCI_OPENINGS; i++) sc->sc_dma[i].dh_flags = 0; |