diff --git a/sys/arch/acorn32/mainbus/fd.c b/sys/arch/acorn32/mainbus/fd.c index 736cb2688d44..08aa9e94678e 100644 --- a/sys/arch/acorn32/mainbus/fd.c +++ b/sys/arch/acorn32/mainbus/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.60 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.61 2019/11/10 21:16:21 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.60 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.61 2019/11/10 21:16:21 chs Exp $"); #include "opt_ddb.h" @@ -1398,11 +1398,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if(fd_formb == 0) - return ENOMEM; - - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/algor/algor/algor_p4032_intr.c b/sys/arch/algor/algor/algor_p4032_intr.c index 346c479d0af9..085ed39d22be 100644 --- a/sys/arch/algor/algor/algor_p4032_intr.c +++ b/sys/arch/algor/algor/algor_p4032_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: algor_p4032_intr.c,v 1.25 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: algor_p4032_intr.c,v 1.26 2019/11/10 21:16:21 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: algor_p4032_intr.c,v 1.25 2014/03/29 19:28:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: algor_p4032_intr.c,v 1.26 2019/11/10 21:16:21 chs Exp $"); #include "opt_ddb.h" #define __INTR_PRIVATE @@ -352,10 +352,7 @@ algor_p4032_intr_establish(int irq, int (*func)(void *), void *arg) KASSERT(irq == irqmap->irqidx); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = 0; diff --git a/sys/arch/algor/algor/algor_p5064_intr.c b/sys/arch/algor/algor/algor_p5064_intr.c index 7fe2d3bc1d5b..d4eba6fc2a4f 100644 --- a/sys/arch/algor/algor/algor_p5064_intr.c +++ b/sys/arch/algor/algor/algor_p5064_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: algor_p5064_intr.c,v 1.28 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: algor_p5064_intr.c,v 1.29 2019/11/10 21:16:21 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.28 2014/03/29 19:28:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.29 2019/11/10 21:16:21 chs Exp $"); #include "opt_ddb.h" #define __INTR_PRIVATE @@ -445,10 +445,7 @@ algor_p5064_intr_establish(int irq, int (*func)(void *), void *arg) KASSERT(irq == irqmap->irqidx); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = 0; diff --git a/sys/arch/algor/algor/algor_p6032_intr.c b/sys/arch/algor/algor/algor_p6032_intr.c index 4708ceca043d..069dbfab3990 100644 --- a/sys/arch/algor/algor/algor_p6032_intr.c +++ b/sys/arch/algor/algor/algor_p6032_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: algor_p6032_intr.c,v 1.22 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: algor_p6032_intr.c,v 1.23 2019/11/10 21:16:21 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: algor_p6032_intr.c,v 1.22 2014/03/29 19:28:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: algor_p6032_intr.c,v 1.23 2019/11/10 21:16:21 chs Exp $"); #include "opt_ddb.h" #define __INTR_PRIVATE @@ -313,10 +313,7 @@ algor_p6032_intr_establish(int irq, int (*func)(void *), void *arg) KASSERT(irq == irqmap->irqidx); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = 0; diff --git a/sys/arch/algor/pci/pcib.c b/sys/arch/algor/pci/pcib.c index bb3a735f445a..f46fd58af022 100644 --- a/sys/arch/algor/pci/pcib.c +++ b/sys/arch/algor/pci/pcib.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcib.c,v 1.24 2011/07/09 16:03:01 matt Exp $ */ +/* $NetBSD: pcib.c,v 1.25 2019/11/10 21:16:22 chs Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.24 2011/07/09 16:03:01 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.25 2019/11/10 21:16:22 chs Exp $"); #include "opt_algor_p5064.h" #include "opt_algor_p6032.h" @@ -449,10 +449,7 @@ pcib_isa_intr_establish(void *v, int irq, int type, int level, return (NULL); } - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/alpha/common/shared_intr.c b/sys/arch/alpha/common/shared_intr.c index 0377ec8b824d..0720ac5cecab 100644 --- a/sys/arch/alpha/common/shared_intr.c +++ b/sys/arch/alpha/common/shared_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: shared_intr.c,v 1.21 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: shared_intr.c,v 1.22 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -33,7 +33,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.21 2012/02/06 02:14:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: shared_intr.c,v 1.22 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -72,10 +72,7 @@ alpha_shared_intr_alloc(unsigned int n, unsigned int namesize) unsigned int i; intr = malloc(n * sizeof (struct alpha_shared_intr), M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (intr == NULL) - panic("alpha_shared_intr_alloc: couldn't malloc intr"); - + M_WAITOK); for (i = 0; i < n; i++) { TAILQ_INIT(&intr[i].intr_q); intr[i].intr_sharetype = IST_NONE; @@ -85,10 +82,7 @@ alpha_shared_intr_alloc(unsigned int n, unsigned int namesize) intr[i].intr_private = NULL; if (namesize != 0) { intr[i].intr_string = malloc(namesize, M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (intr[i].intr_string == NULL) - panic("alpha_shared_intr_alloc: couldn't " - "malloc intr string"); + M_WAITOK); } else intr[i].intr_string = NULL; } @@ -136,11 +130,7 @@ alpha_shared_intr_establish(struct alpha_shared_intr *intr, unsigned int num, return NULL; } - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("alpha_shared_intr_establish: can't malloc intrhand"); - + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); #ifdef DIAGNOSTIC if (type == IST_NONE) panic("alpha_shared_intr_establish: bogus type"); diff --git a/sys/arch/alpha/pci/dwlpx_dma.c b/sys/arch/alpha/pci/dwlpx_dma.c index c13cfe518d1a..d82bf20efc7c 100644 --- a/sys/arch/alpha/pci/dwlpx_dma.c +++ b/sys/arch/alpha/pci/dwlpx_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: dwlpx_dma.c,v 1.24 2014/03/21 16:39:29 christos Exp $ */ +/* $NetBSD: dwlpx_dma.c,v 1.25 2019/11/10 21:16:22 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.24 2014/03/21 16:39:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwlpx_dma.c,v 1.25 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -210,9 +210,7 @@ dwlpx_dma_init(struct dwlpx_config *ccp) * SGVA base: 0 */ #define EXNAMELEN 16 - exname = malloc(EXNAMELEN, M_DEVBUF, M_NOWAIT); - if (exname == NULL) - panic("dwlpx_dma_init"); + exname = malloc(EXNAMELEN, M_DEVBUF, M_WAITOK); snprintf(exname, EXNAMELEN, "%s_sgmap_a", device_xname(ccp->cc_sc->dwlpx_dev)); alpha_sgmap_init(t, &ccp->cc_sgmap, exname, DWLPx_SG_MAPPED_BASE, diff --git a/sys/arch/alpha/tc/ioasic.c b/sys/arch/alpha/tc/ioasic.c index fad3baf1019a..0bdc5ab29643 100644 --- a/sys/arch/alpha/tc/ioasic.c +++ b/sys/arch/alpha/tc/ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: ioasic.c,v 1.46 2014/03/26 08:09:06 christos Exp $ */ +/* $NetBSD: ioasic.c,v 1.47 2019/11/10 21:16:22 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.46 2014/03/26 08:09:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.47 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -196,9 +196,7 @@ ioasicattach(device_t parent, device_t self, void *aux) ioasicintrs[i].iai_func = ioasic_intrnull; ioasicintrs[i].iai_arg = (void *)i; - cp = malloc(len, M_DEVBUF, M_NOWAIT); - if (cp == NULL) - panic("ioasicattach"); + cp = malloc(len, M_DEVBUF, M_WAITOK); snprintf(cp, len, "slot %lu", i); evcnt_attach_dynamic(&ioasicintrs[i].iai_evcnt, EVCNT_TYPE_INTR, pevcnt, device_xname(self), cp); diff --git a/sys/arch/alpha/tc/tc_3000_300.c b/sys/arch/alpha/tc/tc_3000_300.c index b48784586ce2..fc59a42cbe13 100644 --- a/sys/arch/alpha/tc/tc_3000_300.c +++ b/sys/arch/alpha/tc/tc_3000_300.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc_3000_300.c,v 1.33 2014/03/26 08:09:06 christos Exp $ */ +/* $NetBSD: tc_3000_300.c,v 1.34 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.33 2014/03/26 08:09:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.34 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -111,9 +111,7 @@ tc_3000_300_intr_setup(void) tc_3000_300_intr[i].tci_func = tc_3000_300_intrnull; tc_3000_300_intr[i].tci_arg = (void *)i; - cp = malloc(len, M_DEVBUF, M_NOWAIT); - if (cp == NULL) - panic("tc_3000_300_intr_setup"); + cp = malloc(len, M_DEVBUF, M_WAITOK); snprintf(cp, len, "slot %lu", i); evcnt_attach_dynamic(&tc_3000_300_intr[i].tci_evcnt, EVCNT_TYPE_INTR, NULL, "tc", cp); diff --git a/sys/arch/alpha/tc/tc_3000_500.c b/sys/arch/alpha/tc/tc_3000_500.c index 13b5c3afb306..5f33ec3a3e5b 100644 --- a/sys/arch/alpha/tc/tc_3000_500.c +++ b/sys/arch/alpha/tc/tc_3000_500.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc_3000_500.c,v 1.32 2014/03/26 08:09:06 christos Exp $ */ +/* $NetBSD: tc_3000_500.c,v 1.33 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.32 2014/03/26 08:09:06 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.33 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -135,9 +135,7 @@ tc_3000_500_intr_setup(void) tc_3000_500_intr[i].tci_func = tc_3000_500_intrnull; tc_3000_500_intr[i].tci_arg = (void *)i; - cp = malloc(len, M_DEVBUF, M_NOWAIT); - if (cp == NULL) - panic("tc_3000_500_intr_setup"); + cp = malloc(len, M_DEVBUF, M_WAITOK); snprintf(cp, len, "slot %lu", i); evcnt_attach_dynamic(&tc_3000_500_intr[i].tci_evcnt, EVCNT_TYPE_INTR, NULL, "tc", cp); diff --git a/sys/arch/alpha/tc/tc_dma_3000_500.c b/sys/arch/alpha/tc/tc_dma_3000_500.c index 9bf4bb463ad8..d9a3568ed4b6 100644 --- a/sys/arch/alpha/tc/tc_dma_3000_500.c +++ b/sys/arch/alpha/tc/tc_dma_3000_500.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc_dma_3000_500.c,v 1.20 2017/06/22 16:46:52 flxd Exp $ */ +/* $NetBSD: tc_dma_3000_500.c,v 1.21 2019/11/10 21:16:22 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: tc_dma_3000_500.c,v 1.20 2017/06/22 16:46:52 flxd Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tc_dma_3000_500.c,v 1.21 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -86,10 +86,7 @@ tc_dma_init_3000_500(int nslots) /* Allocate per-slot DMA info. */ sisize = nslots * sizeof(struct tc_dma_slot_info); - tc_dma_slot_info = malloc(sisize, M_DEVBUF, M_NOWAIT); - if (tc_dma_slot_info == NULL) - panic("tc_dma_init: can't allocate per-slot DMA info"); - memset(tc_dma_slot_info, 0, sisize); + tc_dma_slot_info = malloc(sisize, M_DEVBUF, M_WAITOK | M_ZERO); /* Default all slots to direct-mapped. */ for (i = 0; i < nslots; i++) diff --git a/sys/arch/amd64/amd64/netbsd32_machdep.c b/sys/arch/amd64/amd64/netbsd32_machdep.c index 267fdeaff7f9..a90e2d093e47 100644 --- a/sys/arch/amd64/amd64/netbsd32_machdep.c +++ b/sys/arch/amd64/amd64/netbsd32_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_machdep.c,v 1.128 2019/09/26 01:39:22 christos Exp $ */ +/* $NetBSD: netbsd32_machdep.c,v 1.129 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.128 2019/09/26 01:39:22 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.129 2019/11/10 21:16:22 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -554,10 +554,7 @@ x86_64_set_ldt32(struct lwp *l, void *args, register_t *retval) if (ua.num < 0 || ua.num > 8192) return EINVAL; - descv = malloc(sizeof(*descv) * ua.num, M_TEMP, M_NOWAIT); - if (descv == NULL) - return ENOMEM; - + descv = malloc(sizeof(*descv) * ua.num, M_TEMP, M_WAITOK); error = copyin((void *)(uintptr_t)ua32.desc, descv, sizeof(*descv) * ua.num); if (error == 0) @@ -586,9 +583,6 @@ x86_64_get_ldt32(struct lwp *l, void *args, register_t *retval) return EINVAL; cp = malloc(ua.num * sizeof(union descriptor), M_TEMP, M_WAITOK); - if (cp == NULL) - return ENOMEM; - error = x86_get_ldt1(l, &ua, cp); *retval = ua.num; if (error == 0) diff --git a/sys/arch/amiga/dev/siop.c b/sys/arch/amiga/dev/siop.c index 1bfe098163f9..bb8e4ea8ffce 100644 --- a/sys/arch/amiga/dev/siop.c +++ b/sys/arch/amiga/dev/siop.c @@ -1,4 +1,4 @@ -/* $NetBSD: siop.c,v 1.69 2014/09/21 15:44:17 christos Exp $ */ +/* $NetBSD: siop.c,v 1.70 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -70,7 +70,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.69 2014/09/21 15:44:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.70 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -567,9 +567,7 @@ siopinitialize(struct siop_softc *sc) */ sc->sc_acb = malloc(sizeof(struct siop_acb) * SIOP_NACB, - M_DEVBUF, M_NOWAIT); - if (sc->sc_acb == NULL) - panic("siopinitialize: ACB malloc failed!"); + M_DEVBUF, M_WAITOK); sc->sc_tcp[1] = 1000 / sc->sc_clock_freq; sc->sc_tcp[2] = 1500 / sc->sc_clock_freq; diff --git a/sys/arch/amiga/dev/siop2.c b/sys/arch/amiga/dev/siop2.c index 6051a6145ac8..68b9e9f440a4 100644 --- a/sys/arch/amiga/dev/siop2.c +++ b/sys/arch/amiga/dev/siop2.c @@ -1,4 +1,4 @@ -/* $NetBSD: siop2.c,v 1.43 2014/09/21 15:44:47 christos Exp $ */ +/* $NetBSD: siop2.c,v 1.44 2019/11/10 21:16:22 chs Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -70,7 +70,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: siop2.c,v 1.43 2014/09/21 15:44:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siop2.c,v 1.44 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -554,9 +554,7 @@ siopnginitialize(struct siop_softc *sc) */ sc->sc_acb = malloc(sizeof(struct siop_acb) * SIOP_NACB, - M_DEVBUF, M_NOWAIT); - if (sc->sc_acb == NULL) - panic("siopnginitialize: ACB malloc failed!"); + M_DEVBUF, M_WAITOK); sc->sc_tcp[1] = 1000 / sc->sc_clock_freq; sc->sc_tcp[2] = 1500 / sc->sc_clock_freq; diff --git a/sys/arch/amigappc/amigappc/pic_amiga.c b/sys/arch/amigappc/amigappc/pic_amiga.c index c142d2222217..eeb4424de476 100644 --- a/sys/arch/amigappc/amigappc/pic_amiga.c +++ b/sys/arch/amigappc/amigappc/pic_amiga.c @@ -1,4 +1,4 @@ -/* $NetBSD: pic_amiga.c,v 1.3 2011/06/19 07:59:47 matt Exp $ */ +/* $NetBSD: pic_amiga.c,v 1.4 2019/11/10 21:16:22 chs Exp $ */ /*- * Copyright (c) 2008,2009,2010 Frank Wille. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_amiga.c,v 1.3 2011/06/19 07:59:47 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_amiga.c,v 1.4 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -65,8 +65,7 @@ setup_amiga_intr(void) struct amiga_ops *amipic; struct pic_ops *pic; - amipic = malloc(sizeof(struct amiga_ops), M_DEVBUF, M_NOWAIT); - KASSERT(amipic != NULL); + amipic = malloc(sizeof(struct amiga_ops), M_DEVBUF, M_WAITOK); pic = &amipic->pic; pic->pic_numintrs = MAXIPL; diff --git a/sys/arch/arc/arc/p_dti_arcstation.c b/sys/arch/arc/arc/p_dti_arcstation.c index cf995415c28e..0bbbf0a8c42a 100644 --- a/sys/arch/arc/arc/p_dti_arcstation.c +++ b/sys/arch/arc/arc/p_dti_arcstation.c @@ -1,4 +1,4 @@ -/* $NetBSD: p_dti_arcstation.c,v 1.17 2011/07/01 19:28:00 dyoung Exp $ */ +/* $NetBSD: p_dti_arcstation.c,v 1.18 2019/11/10 21:16:22 chs Exp $ */ /* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */ /* @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: p_dti_arcstation.c,v 1.17 2011/07/01 19:28:00 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: p_dti_arcstation.c,v 1.18 2019/11/10 21:16:22 chs Exp $"); #define __INTR_PRIVATE #include @@ -165,7 +165,7 @@ btl_dti_arcstation_bouncemem(u_int *basep, u_int *sizep) *sizep = TYNE_S_BOUNCE; /* Good enough? XXX */ #if 0 - *basep = (u_int) malloc(*sizep, M_DEVBUF, M_NOWAIT); + *basep = (u_int) malloc(*sizep, M_DEVBUF, M_WAITOK); #else *basep = (u_int) rpc44_buffer | 0xa0000000; #endif diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c index c29b9ff78597..8b1f49138902 100644 --- a/sys/arch/arc/isa/isabus.c +++ b/sys/arch/arc/isa/isabus.c @@ -1,4 +1,4 @@ -/* $NetBSD: isabus.c,v 1.49 2012/10/27 17:17:35 chs Exp $ */ +/* $NetBSD: isabus.c,v 1.50 2019/11/10 21:16:22 chs Exp $ */ /* $OpenBSD: isabus.c,v 1.15 1998/03/16 09:38:46 pefo Exp $ */ /* NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp */ @@ -120,7 +120,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include -__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.49 2012/10/27 17:17:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.50 2019/11/10 21:16:22 chs Exp $"); #include #include @@ -340,10 +340,7 @@ isabr_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, struct isa_intrhand **p, *q, *ih; static struct isa_intrhand fakehand = {NULL, fakeintr}; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("isa_intr_establish: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); if (!LEGAL_IRQ(irq) || type == IST_NONE) panic("intr_establish: bogus irq or type"); diff --git a/sys/arch/arc/pci/necpb.c b/sys/arch/arc/pci/necpb.c index 48d99b5c0d4c..fd04c25718a8 100644 --- a/sys/arch/arc/pci/necpb.c +++ b/sys/arch/arc/pci/necpb.c @@ -1,4 +1,4 @@ -/* $NetBSD: necpb.c,v 1.42 2015/10/02 05:22:49 msaitoh Exp $ */ +/* $NetBSD: necpb.c,v 1.43 2019/11/10 21:16:23 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.42 2015/10/02 05:22:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.43 2019/11/10 21:16:23 chs Exp $"); #include "opt_pci.h" @@ -407,10 +407,7 @@ necpb_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, if (ih >= 4) panic("%s: bogus handle", __func__); - n = malloc(sizeof(struct necpb_intrhand), M_DEVBUF, M_NOWAIT); - if (n == NULL) - panic("%s: can't malloc interrupt handle", __func__); - + n = malloc(sizeof(struct necpb_intrhand), M_DEVBUF, M_WAITOK); n->ih_func = func; n->ih_arg = arg; n->ih_next = NULL; diff --git a/sys/arch/arm/at91/at91cf.c b/sys/arch/arm/at91/at91cf.c index fc4faadbea66..2a84b2b38778 100644 --- a/sys/arch/arm/at91/at91cf.c +++ b/sys/arch/arm/at91/at91cf.c @@ -1,5 +1,5 @@ -/* $Id: at91cf.c,v 1.4 2011/07/26 22:52:47 dyoung Exp $ */ -/* $NetBSD: at91cf.c,v 1.4 2011/07/26 22:52:47 dyoung Exp $ */ +/* $Id: at91cf.c,v 1.5 2019/11/10 21:16:23 chs Exp $ */ +/* $NetBSD: at91cf.c,v 1.5 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2007 Embedtronics Oy. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91cf.c,v 1.4 2011/07/26 22:52:47 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91cf.c,v 1.5 2019/11/10 21:16:23 chs Exp $"); #include #include @@ -174,12 +174,7 @@ at91cf_attach_common(device_t parent, device_t self, void *aux, printf("\n"); /* socket 0 */ - ph = malloc(sizeof(struct at91cf_handle), M_DEVBUF, M_NOWAIT|M_ZERO); - if (ph == NULL) { - printf("%s: Cannot allocate memory\n", device_xname(self)); - // @@@@ unmap? @@@@ - return; /* ENOMEM */ - } + ph = malloc(sizeof(struct at91cf_handle), M_DEVBUF, M_WAITOK|M_ZERO); sc->sc_ph = ph; ph->ph_sc = sc; ph->ph_space[IO].base = sa->sa_addr + IO_BASE; diff --git a/sys/arch/arm/at91/at91dbgu.c b/sys/arch/arm/at91/at91dbgu.c index 4c75970a55af..4ec8ed09ef26 100644 --- a/sys/arch/arm/at91/at91dbgu.c +++ b/sys/arch/arm/at91/at91dbgu.c @@ -1,5 +1,5 @@ -/* $Id: at91dbgu.c,v 1.15 2015/09/21 13:31:30 skrll Exp $ */ -/* $NetBSD: at91dbgu.c,v 1.15 2015/09/21 13:31:30 skrll Exp $ */ +/* $Id: at91dbgu.c,v 1.16 2019/11/10 21:16:23 chs Exp $ */ +/* $NetBSD: at91dbgu.c,v 1.16 2019/11/10 21:16:23 chs Exp $ */ /* * @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.15 2015/09/21 13:31:30 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.16 2019/11/10 21:16:23 chs Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -256,14 +256,9 @@ at91dbgu_attach(device_t parent, device_t self, void *aux) tp->t_hwiflow = at91dbgu_hwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(AT91DBGU_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(AT91DBGU_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = AT91DBGU_RING_SIZE; - if (sc->sc_rbuf == NULL) { - printf("%s: unable to allocate ring buffer\n", - device_xname(sc->sc_dev)); - return; - } sc->sc_ebuf = sc->sc_rbuf + (AT91DBGU_RING_SIZE << 1); sc->sc_tbc = 0; diff --git a/sys/arch/arm/clps711x/clpscom.c b/sys/arch/arm/clps711x/clpscom.c index 1bb489237431..87a54e00b2b1 100644 --- a/sys/arch/arm/clps711x/clpscom.c +++ b/sys/arch/arm/clps711x/clpscom.c @@ -1,4 +1,4 @@ -/* $NetBSD: clpscom.c,v 1.7 2018/09/03 16:29:23 riastradh Exp $ */ +/* $NetBSD: clpscom.c,v 1.8 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: clpscom.c,v 1.7 2018/09/03 16:29:23 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clpscom.c,v 1.8 2019/11/10 21:16:23 chs Exp $"); #include "rnd.h" @@ -222,11 +222,7 @@ clpscom_attach(device_t parent, device_t self, void *aux) sc->sc_tty->t_hwiflow = clpscom_hwiflow; sc->sc_tbc = 0; - sc->sc_rbuf = malloc(CLPSCOM_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); - if (sc->sc_rbuf == NULL) { - aprint_error_dev(self, "unable to allocate ring buffer\n"); - return; - } + sc->sc_rbuf = malloc(CLPSCOM_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = CLPSCOM_RING_SIZE; diff --git a/sys/arch/arm/ep93xx/ep93xx_intr.c b/sys/arch/arm/ep93xx/ep93xx_intr.c index 4a1698936fbe..b7f379536b9d 100644 --- a/sys/arch/arm/ep93xx/ep93xx_intr.c +++ b/sys/arch/arm/ep93xx/ep93xx_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ep93xx_intr.c,v 1.24 2015/04/08 08:35:54 ozaki-r Exp $ */ +/* $NetBSD: ep93xx_intr.c,v 1.25 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ep93xx_intr.c,v 1.24 2015/04/08 08:35:54 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ep93xx_intr.c,v 1.25 2019/11/10 21:16:23 chs Exp $"); /* * Interrupt support for the Cirrus Logic EP93XX @@ -287,10 +287,7 @@ ep93xx_intr_establish(int irq, int ipl, int (*ih_func)(void *), void *arg) if (ipl < 0 || ipl > NIPL) panic("ep93xx_intr_establish: IPL %d out of range", ipl); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = ih_func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/arm/ep93xx/epcom.c b/sys/arch/arm/ep93xx/epcom.c index 338a923a91ed..41a54f234fe0 100644 --- a/sys/arch/arm/ep93xx/epcom.c +++ b/sys/arch/arm/ep93xx/epcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: epcom.c,v 1.30 2015/04/13 21:18:41 riastradh Exp $ */ +/* $NetBSD: epcom.c,v 1.31 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc. * All rights reserved. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.30 2015/04/13 21:18:41 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.31 2019/11/10 21:16:23 chs Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -213,14 +213,9 @@ epcom_attach_subr(struct epcom_softc *sc) tp->t_hwiflow = epcomhwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(EPCOM_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(EPCOM_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = EPCOM_RING_SIZE; - if (sc->sc_rbuf == NULL) { - printf("%s: unable to allocate ring buffer\n", - device_xname(sc->sc_dev)); - return; - } sc->sc_ebuf = sc->sc_rbuf + (EPCOM_RING_SIZE << 1); sc->sc_tbc = 0; diff --git a/sys/arch/arm/ep93xx/eppcic.c b/sys/arch/arm/ep93xx/eppcic.c index d97b7e4cbf42..f48eb10442ca 100644 --- a/sys/arch/arm/ep93xx/eppcic.c +++ b/sys/arch/arm/ep93xx/eppcic.c @@ -1,4 +1,4 @@ -/* $NetBSD: eppcic.c,v 1.7 2012/10/27 17:17:37 chs Exp $ */ +/* $NetBSD: eppcic.c,v 1.8 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: eppcic.c,v 1.7 2012/10/27 17:17:37 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eppcic.c,v 1.8 2019/11/10 21:16:23 chs Exp $"); #include #include @@ -175,10 +175,7 @@ eppcic_attach_common(device_t parent, device_t self, void *aux, epled_red_off(); #endif /* socket 0 */ - if (!(ph = malloc(sizeof(struct eppcic_handle), M_DEVBUF, M_NOWAIT))) { - printf("%s: Cannot allocate memory\n", device_xname(self)); - return; /* ENOMEM */ - } + ph = malloc(sizeof(struct eppcic_handle), M_DEVBUF, M_WAITOK); sc->sc_ph[0] = ph; ph->ph_sc = sc; ph->ph_socket = 0; diff --git a/sys/arch/arm/footbridge/footbridge_irqhandler.c b/sys/arch/arm/footbridge/footbridge_irqhandler.c index f2a39f8919a6..363507dae19b 100644 --- a/sys/arch/arm/footbridge/footbridge_irqhandler.c +++ b/sys/arch/arm/footbridge/footbridge_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: footbridge_irqhandler.c,v 1.25 2014/04/02 11:35:36 matt Exp $ */ +/* $NetBSD: footbridge_irqhandler.c,v 1.26 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ #endif #include -__KERNEL_RCSID(0,"$NetBSD: footbridge_irqhandler.c,v 1.25 2014/04/02 11:35:36 matt Exp $"); +__KERNEL_RCSID(0,"$NetBSD: footbridge_irqhandler.c,v 1.26 2019/11/10 21:16:23 chs Exp $"); #include "opt_irqstats.h" @@ -227,13 +227,7 @@ footbridge_intr_claim(int irq, int ipl, const char *name, int (*func)(void *), v if (irq < 0 || irq > NIRQ) panic("footbridge_intr_establish: IRQ %d out of range", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - { - printf("No memory"); - return (NULL); - } - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/arm/footbridge/isa/isa_machdep.c b/sys/arch/arm/footbridge/isa/isa_machdep.c index 1de4918b0e45..f3415d591d84 100644 --- a/sys/arch/arm/footbridge/isa/isa_machdep.c +++ b/sys/arch/arm/footbridge/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.21 2014/03/26 08:52:00 christos Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.22 2019/11/10 21:16:23 chs Exp $ */ /*- * Copyright (c) 1996-1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.21 2014/03/26 08:52:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.22 2019/11/10 21:16:23 chs Exp $"); #include "opt_irqstats.h" @@ -338,10 +338,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, int (*ih_ #if 0 printf("isa_intr_establish(%d, %d, %d)\n", irq, type, level); #endif - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - return (NULL); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); if (!LEGAL_IRQ(irq) || type == IST_NONE) panic("intr_establish: bogus irq or type"); diff --git a/sys/arch/arm/gemini/gemini_ipi.c b/sys/arch/arm/gemini/gemini_ipi.c index 8ef013f1bf24..44d5f055519a 100644 --- a/sys/arch/arm/gemini/gemini_ipi.c +++ b/sys/arch/arm/gemini/gemini_ipi.c @@ -7,7 +7,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: gemini_ipi.c,v 1.7 2019/08/30 00:33:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gemini_ipi.c,v 1.8 2019/11/10 21:16:23 chs Exp $"); #include #include @@ -103,12 +103,7 @@ gemini_ipi_intrq_insert(gemini_ipi_softc_t *sc, int (*func)(void *), void *arg) { gemini_ipi_intrq_t *iqp; - iqp = malloc(sizeof(*iqp), M_DEVBUF, M_NOWAIT|M_ZERO); - if (iqp == NULL) { - printf("gemini_ipi_intrq_insert: malloc failed\n"); - return NULL; - } - + iqp = malloc(sizeof(*iqp), M_DEVBUF, M_WAITOK|M_ZERO); iqp->iq_func = func; iqp->iq_arg = arg; SIMPLEQ_INSERT_TAIL(&sc->sc_intrq, iqp, iq_q); @@ -154,12 +149,6 @@ ipi_intr_establish(int (*func)(void *), void *arg) return NULL; ih = gemini_ipi_intrq_insert(sc, func, arg); -#ifdef DEBUG - if (ih == NULL) - panic("%s: gemini_ipi_intrq_insert failed", - device_xname(sc->sc_dev)); -#endif - return ih; } diff --git a/sys/arch/arm/gemini/gemini_lpchc.c b/sys/arch/arm/gemini/gemini_lpchc.c index 199a9b902ddd..7bd9ffbf0369 100644 --- a/sys/arch/arm/gemini/gemini_lpchc.c +++ b/sys/arch/arm/gemini/gemini_lpchc.c @@ -1,4 +1,4 @@ -/* $NetBSD: gemini_lpchc.c,v 1.3 2019/01/08 19:41:10 jdolecek Exp $ */ +/* $NetBSD: gemini_lpchc.c,v 1.4 2019/11/10 21:16:23 chs Exp $ */ /* * GEMINI LPC Host Controller @@ -7,7 +7,7 @@ #include "locators.h" #include -__KERNEL_RCSID(0, "$NetBSD: gemini_lpchc.c,v 1.3 2019/01/08 19:41:10 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gemini_lpchc.c,v 1.4 2019/11/10 21:16:23 chs Exp $"); #include #include @@ -94,12 +94,7 @@ gemini_lpchc_intrq_insert(gemini_lpchc_softc_t *sc, int (*func)(void *), { gemini_lpchc_intrq_t *iqp; - iqp = malloc(sizeof(*iqp), M_DEVBUF, M_NOWAIT|M_ZERO); - if (iqp == NULL) { - printf("gemini_lpchc_intrq_insert: malloc failed\n"); - return NULL; - } - + iqp = malloc(sizeof(*iqp), M_DEVBUF, M_WAITOK|M_ZERO); iqp->iq_func = func; iqp->iq_arg = arg; iqp->iq_bit = bit; @@ -199,10 +194,6 @@ gemini_lpchc_intr_establish(lpcintrtag_t tag, uint irq, gemini_lpchc_sirq_enable(iot, ioh); ih = gemini_lpchc_intrq_insert(sc, func, arg, bit, isedge); - if (ih == NULL) - if (gemini_lpchc_intrq_empty(sc)) - gemini_lpchc_sirq_disable(iot, ioh); - return ih; } @@ -228,4 +219,3 @@ printf("%s: exit\n", __FUNCTION__); return rv; } - diff --git a/sys/arch/arm/gemini/gemini_pci.c b/sys/arch/arm/gemini/gemini_pci.c index 5e233983ddea..d87b23d56063 100644 --- a/sys/arch/arm/gemini/gemini_pci.c +++ b/sys/arch/arm/gemini/gemini_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: gemini_pci.c,v 1.19 2018/11/16 15:06:22 jmcneill Exp $ */ +/* $NetBSD: gemini_pci.c,v 1.20 2019/11/10 21:16:23 chs Exp $ */ /* adapted from: * NetBSD: i80312_pci.c,v 1.9 2005/12/11 12:16:51 christos Exp @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gemini_pci.c,v 1.19 2018/11/16 15:06:22 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gemini_pci.c,v 1.20 2019/11/10 21:16:23 chs Exp $"); #include "opt_gemini.h" #include "opt_pci.h" @@ -117,12 +117,7 @@ gemini_pci_intrq_insert(void *ih, int (*func)(void *), void *arg) { struct gemini_pci_intrq *iqp; - iqp = malloc(sizeof(*iqp), M_DEVBUF, M_NOWAIT|M_ZERO); - if (iqp == NULL) { - printf("gemini_pci_intrq_insert: malloc failed\n"); - return NULL; - } - + iqp = malloc(sizeof(*iqp), M_DEVBUF, M_WAITOK|M_ZERO); iqp->iq_func = func; iqp->iq_arg = arg; iqp->iq_ih = ih; @@ -406,11 +401,6 @@ gemini_pci_intr_establish(void *v, pci_intr_handle_t pci_ih, int ipl, gemini_pci_intr_handler, v, xname); cookie = gemini_pci_intrq_insert(ih, func, arg); - if (cookie == NULL) { - if (gemini_pci_intrq_empty()) - intr_disestablish(ih); - } - return cookie; } diff --git a/sys/arch/arm/imx/imx51_ipuv3.c b/sys/arch/arm/imx/imx51_ipuv3.c index 2e7c250eb7cc..8bc9c16ab181 100644 --- a/sys/arch/arm/imx/imx51_ipuv3.c +++ b/sys/arch/arm/imx/imx51_ipuv3.c @@ -1,4 +1,4 @@ -/* $NetBSD: imx51_ipuv3.c,v 1.7 2018/03/17 18:34:09 ryo Exp $ */ +/* $NetBSD: imx51_ipuv3.c,v 1.8 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2011, 2012 Genetec Corporation. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.7 2018/03/17 18:34:09 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.8 2019/11/10 21:16:23 chs Exp $"); #include "opt_imx51_ipuv3.h" @@ -932,12 +932,7 @@ imx51_ipuv3_new_screen(struct imx51_ipuv3_softc *sc, width = geometry->panel_width; height = geometry->panel_height; - scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); - if (scr == NULL) - return ENOMEM; - - memset(scr, 0, sizeof(*scr)); - + scr = malloc(sizeof(*scr), M_DEVBUF, M_WAITOK | M_ZERO); scr->nsegs = 0; scr->depth = depth; scr->stride = width * depth / 8; diff --git a/sys/arch/arm/imx/imxuart.c b/sys/arch/arm/imx/imxuart.c index 06605174fbaf..2a4dffbded7e 100644 --- a/sys/arch/arm/imx/imxuart.c +++ b/sys/arch/arm/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $NetBSD: imxuart.c,v 1.21 2018/06/20 07:08:35 hkenken Exp $ */ +/* $NetBSD: imxuart.c,v 1.22 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 2009, 2010 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.21 2018/06/20 07:08:35 hkenken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.22 2019/11/10 21:16:23 chs Exp $"); #include "opt_imxuart.h" #include "opt_ddb.h" @@ -355,15 +355,9 @@ imxuart_attach_subr(struct imxuart_softc *sc) sc->sc_tty = tp; sc->sc_rbuf = malloc(sizeof (*sc->sc_rbuf) * imxuart_rbuf_size, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); sc->sc_rbuf_size = imxuart_rbuf_size; sc->sc_rbuf_in = sc->sc_rbuf_out = 0; - if (sc->sc_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate ring buffer\n"); - return; - } - sc->sc_txfifo_len = 32; sc->sc_txfifo_thresh = 16; /* when USR1.TRDY, fifo has space * for this many characters */ diff --git a/sys/arch/arm/iomd/iomd_irqhandler.c b/sys/arch/arm/iomd/iomd_irqhandler.c index 550951fee1d0..87ebb64d2213 100644 --- a/sys/arch/arm/iomd/iomd_irqhandler.c +++ b/sys/arch/arm/iomd/iomd_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: iomd_irqhandler.c,v 1.22 2014/10/25 10:58:12 skrll Exp $ */ +/* $NetBSD: iomd_irqhandler.c,v 1.23 2019/11/10 21:16:23 chs Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.22 2014/10/25 10:58:12 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.23 2019/11/10 21:16:23 chs Exp $"); #include "opt_irqstats.h" @@ -346,10 +346,7 @@ intr_claim(int irq, int level, const char *name, int (*ih_func)(void *), { irqhandler_t *ih; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (!ih) - panic("intr_claim(): Cannot malloc handler memory"); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_level = level; ih->ih_name = name; ih->ih_func = ih_func; diff --git a/sys/arch/arm/iomd/iomdkbc.c b/sys/arch/arm/iomd/iomdkbc.c index df1d9a83dabd..d74fad9758ea 100644 --- a/sys/arch/arm/iomd/iomdkbc.c +++ b/sys/arch/arm/iomd/iomdkbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: iomdkbc.c,v 1.5 2012/05/14 10:38:08 skrll Exp $ */ +/* $NetBSD: iomdkbc.c,v 1.6 2019/11/10 21:16:23 chs Exp $ */ /*- * Copyright (c) 2004 Ben Harris @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iomdkbc.c,v 1.5 2012/05/14 10:38:08 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iomdkbc.c,v 1.6 2019/11/10 21:16:23 chs Exp $"); #include #include @@ -134,11 +134,7 @@ iomdkbc_attach(device_t parent, device_t self, void *aux) t = &iomdkbc_cntag; } else { t = malloc(sizeof(struct iomdkbc_internal), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (t == NULL) { - aprint_error(": no memory"); - return; - } + M_WAITOK | M_ZERO); t->t_haveport[PCKBPORT_KBD_SLOT] = 1; t->t_iot = ka->ka_iot; t->t_ioh[PCKBPORT_KBD_SLOT] = ka->ka_ioh; @@ -156,11 +152,7 @@ iomdkbc_attach(device_t parent, device_t self, void *aux) if (strcmp(pa->pa_name, "opms") == 0) { if (t == NULL) { t = malloc(sizeof(struct iomdkbc_internal), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (t == NULL) { - aprint_error(": no memory"); - return; - } + M_WAITOK | M_ZERO); } t->t_haveport[PCKBPORT_AUX_SLOT] = 1; t->t_iot = pa->pa_iot; diff --git a/sys/arch/arm/ixp12x0/ixp12x0_com.c b/sys/arch/arm/ixp12x0/ixp12x0_com.c index d8778ab3bc30..42b566d204de 100644 --- a/sys/arch/arm/ixp12x0/ixp12x0_com.c +++ b/sys/arch/arm/ixp12x0/ixp12x0_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp12x0_com.c,v 1.47 2015/04/13 21:18:41 riastradh Exp $ */ +/* $NetBSD: ixp12x0_com.c,v 1.48 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.47 2015/04/13 21:18:41 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.48 2019/11/10 21:16:24 chs Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -212,14 +212,9 @@ ixpcom_attach_subr(struct ixpcom_softc *sc) tp->t_hwiflow = ixpcomhwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(IXPCOM_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(IXPCOM_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = IXPCOM_RING_SIZE; - if (sc->sc_rbuf == NULL) { - printf("%s: unable to allocate ring buffer\n", - device_xname(sc->sc_dev)); - return; - } sc->sc_ebuf = sc->sc_rbuf + (IXPCOM_RING_SIZE << 1); sc->sc_tbc = 0; diff --git a/sys/arch/arm/ixp12x0/ixp12x0_intr.c b/sys/arch/arm/ixp12x0/ixp12x0_intr.c index 3fcca66986f0..b1a040aa392c 100644 --- a/sys/arch/arm/ixp12x0/ixp12x0_intr.c +++ b/sys/arch/arm/ixp12x0/ixp12x0_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp12x0_intr.c,v 1.31 2015/04/08 08:35:54 ozaki-r Exp $ */ +/* $NetBSD: ixp12x0_intr.c,v 1.32 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixp12x0_intr.c,v 1.31 2015/04/08 08:35:54 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp12x0_intr.c,v 1.32 2019/11/10 21:16:24 chs Exp $"); /* * Interrupt support for the Intel ixp12x0 @@ -342,10 +342,7 @@ ixp12x0_intr_establish(int irq, int ipl, int (*ih_func)(void *), void *arg) if (ipl < 0 || ipl > NIPL) panic("ixp12x0_intr_establish: IPL %d out of range", ipl); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = ih_func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/arm/ofw/ofw_irqhandler.c b/sys/arch/arm/ofw/ofw_irqhandler.c index 53e467f14893..a9e63fbc9e93 100644 --- a/sys/arch/arm/ofw/ofw_irqhandler.c +++ b/sys/arch/arm/ofw/ofw_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_irqhandler.c,v 1.21 2014/09/21 15:47:29 christos Exp $ */ +/* $NetBSD: ofw_irqhandler.c,v 1.22 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofw_irqhandler.c,v 1.21 2014/09/21 15:47:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofw_irqhandler.c,v 1.22 2019/11/10 21:16:24 chs Exp $"); #include #include @@ -292,10 +292,7 @@ intr_claim(int irq, int level, int (*ih_func)(void *), void *ih_arg, const char { irqhandler_t *ih; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT|M_ZERO); - if (!ih) - panic("intr_claim(): Cannot malloc handler memory"); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO); ih->ih_level = level; ih->ih_func = ih_func; ih->ih_arg = ih_arg; diff --git a/sys/arch/arm/omap/omap_gpio.c b/sys/arch/arm/omap/omap_gpio.c index 29537b1a2c96..c80c41175f2e 100644 --- a/sys/arch/arm/omap/omap_gpio.c +++ b/sys/arch/arm/omap/omap_gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: omap_gpio.c,v 1.8 2018/03/13 06:41:53 ryo Exp $ */ +/* $NetBSD: omap_gpio.c,v 1.9 2019/11/10 21:16:24 chs Exp $ */ /* * The OMAP GPIO Controller interface is inspired by pxa2x0_gpio.c @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: omap_gpio.c,v 1.8 2018/03/13 06:41:53 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: omap_gpio.c,v 1.9 2019/11/10 21:16:24 chs Exp $"); #include #include @@ -275,10 +275,7 @@ omap_gpio_intr_establish(u_int gpio, int level, int spl, panic("omapgpio: Illegal shared interrupt on pin %d", gpio); } - gh = malloc(sizeof(struct gpio_irq_handler), M_DEVBUF, M_NOWAIT); - if (gh == NULL) - return gh; - + gh = malloc(sizeof(struct gpio_irq_handler), M_DEVBUF, M_WAITOK); gh->gh_func = func; gh->gh_arg = arg; gh->gh_spl = spl; @@ -510,4 +507,3 @@ omapgpio_intr(void *arg) return (handled); } - diff --git a/sys/arch/arm/s3c2xx0/s3c2440_dma.c b/sys/arch/arm/s3c2xx0/s3c2440_dma.c index b9ef672d0df9..8b520d2372e9 100644 --- a/sys/arch/arm/s3c2xx0/s3c2440_dma.c +++ b/sys/arch/arm/s3c2xx0/s3c2440_dma.c @@ -273,10 +273,10 @@ s3c2440_dma_intr(void *arg) } dmac_xfer_t -s3c2440_dmac_allocate_xfer(int flags) { +s3c2440_dmac_allocate_xfer(void) { struct dmac_xfer_state *dxs; - dxs = malloc(sizeof(struct dmac_xfer_state), M_DEVBUF, flags); + dxs = malloc(sizeof(struct dmac_xfer_state), M_DEVBUF, M_WAITOK); dxs->dxs_xfer.dx_done = NULL; dxs->dxs_xfer.dx_sync_bus = DMAC_SYNC_BUS_AUTO; diff --git a/sys/arch/arm/s3c2xx0/s3c2440_dma.h b/sys/arch/arm/s3c2xx0/s3c2440_dma.h index 5974c8552a33..d2e763c30b1b 100644 --- a/sys/arch/arm/s3c2xx0/s3c2440_dma.h +++ b/sys/arch/arm/s3c2xx0/s3c2440_dma.h @@ -115,7 +115,7 @@ struct dmac_xfer { }; /* DMA API, inspired by pxa2x0_dmac.h */ -dmac_xfer_t s3c2440_dmac_allocate_xfer(int); +dmac_xfer_t s3c2440_dmac_allocate_xfer(void); void s3c2440_dmac_free_xfer(dmac_xfer_t); int s3c2440_dmac_start_xfer(dmac_xfer_t); void s3c2440_dmac_abort_xfer(dmac_xfer_t); diff --git a/sys/arch/arm/s3c2xx0/s3c2440_i2s.c b/sys/arch/arm/s3c2xx0/s3c2440_i2s.c index e7e3fe2ee4b8..5195916e6f9c 100644 --- a/sys/arch/arm/s3c2xx0/s3c2440_i2s.c +++ b/sys/arch/arm/s3c2xx0/s3c2440_i2s.c @@ -316,25 +316,13 @@ s3c2440_i2s_alloc(void *handle, int direction, size_t size, int flags, s3c2440_i2s_buf_t *out) { - int kalloc_flags = KM_SLEEP; - int dma_flags = BUS_DMA_WAITOK; int retval = 0; struct s3c2xx0_softc *sc = s3c2xx0_softc; /* Shortcut */ s3c2440_i2s_buf_t buf; DPRINTF(("%s\n", __func__)); - if (flags & M_NOWAIT) { - kalloc_flags = KM_NOSLEEP; - dma_flags = BUS_DMA_NOWAIT; - } - - *out = kmem_alloc(sizeof(struct s3c2440_i2s_buf), kalloc_flags); - if (*out == NULL) { - DPRINTF(("Failed to allocate memory\n")); - return ENOMEM; - } - + *out = kmem_alloc(sizeof(struct s3c2440_i2s_buf), KM_SLEEP); buf = *out; buf->i2b_parent = handle; buf->i2b_size = size; @@ -346,7 +334,7 @@ s3c2440_i2s_alloc(void *handle, /* We first allocate some DMA-friendly memory for the buffer... */ retval = bus_dmamem_alloc(sc->sc_dmat, buf->i2b_size, NBPG, 0, buf->i2b_segs, buf->i2b_nsegs, &buf->i2b_nsegs, - dma_flags); + BUS_DMA_WAITOK); if (retval != 0) { printf("%s: Failed to allocate DMA memory\n", __func__); goto cleanup_dealloc; @@ -355,7 +343,7 @@ s3c2440_i2s_alloc(void *handle, DPRINTF(("%s: Using %d DMA segments\n", __func__, buf->i2b_nsegs)); retval = bus_dmamem_map(sc->sc_dmat, buf->i2b_segs, buf->i2b_nsegs, - buf->i2b_size, &buf->i2b_addr, dma_flags); + buf->i2b_size, &buf->i2b_addr, BUS_DMA_WAITOK); if (retval != 0) { printf("%s: Failed to map DMA memory\n", __func__); @@ -367,7 +355,7 @@ s3c2440_i2s_alloc(void *handle, /* XXX: Not sure if nsegments is really 1...*/ retval = bus_dmamap_create(sc->sc_dmat, buf->i2b_size, 1, - buf->i2b_size, 0, dma_flags, + buf->i2b_size, 0, BUS_DMA_WAITOK, &buf->i2b_dmamap); if (retval != 0) { printf("%s: Failed to create DMA map\n", __func__); @@ -376,15 +364,9 @@ s3c2440_i2s_alloc(void *handle, DPRINTF(("%s: DMA map created successfully\n", __func__)); - buf->i2b_xfer = s3c2440_dmac_allocate_xfer(M_NOWAIT); - if (buf->i2b_xfer == NULL) { - retval = ENOMEM; - goto cleanup_destroy_dmamap; - } + buf->i2b_xfer = s3c2440_dmac_allocate_xfer(); return 0; -cleanup_destroy_dmamap: - bus_dmamap_destroy(sc->sc_dmat, buf->i2b_dmamap); cleanup_unmap_dma: bus_dmamem_unmap(sc->sc_dmat, &buf->i2b_addr, buf->i2b_size); cleanup_dealloc_dma: diff --git a/sys/arch/arm/s3c2xx0/s3c2440_sdi.c b/sys/arch/arm/s3c2xx0/s3c2440_sdi.c index bec7a45661b6..df43f9695361 100644 --- a/sys/arch/arm/s3c2xx0/s3c2440_sdi.c +++ b/sys/arch/arm/s3c2xx0/s3c2440_sdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: s3c2440_sdi.c,v 1.4 2015/05/25 15:04:01 christos Exp $ */ +/* $NetBSD: s3c2440_sdi.c,v 1.5 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: s3c2440_sdi.c,v 1.4 2015/05/25 15:04:01 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: s3c2440_sdi.c,v 1.5 2019/11/10 21:16:24 chs Exp $"); #include #include @@ -236,7 +236,7 @@ sssdi_attach(device_t parent, device_t self, void *aux) /* Is it a good idea to get the private parts of sdmmc ? */ sc->sdmmc = config_found(sc->dev, &saa, NULL); - sc->sc_xfer = s3c2440_dmac_allocate_xfer(M_NOWAIT); + sc->sc_xfer = s3c2440_dmac_allocate_xfer(); sc->sc_dr.ds_addr = S3C2440_SDI_BASE+SDI_DAT_LI_W; sc->sc_dr.ds_len = 4; } diff --git a/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c b/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c index 33af6305182b..b5135e87d92d 100644 --- a/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c +++ b/sys/arch/arm/s3c2xx0/s3c24x0_lcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: s3c24x0_lcd.c,v 1.13 2018/09/03 16:29:23 riastradh Exp $ */ +/* $NetBSD: s3c24x0_lcd.c,v 1.14 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2004 Genetec Corporation. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: s3c24x0_lcd.c,v 1.13 2018/09/03 16:29:23 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: s3c24x0_lcd.c,v 1.14 2019/11/10 21:16:24 chs Exp $"); #include #include @@ -338,12 +338,7 @@ s3c24x0_lcd_new_screen(struct s3c24x0_lcd_softc *sc, return NULL; } - scr = malloc(sizeof *scr, M_DEVBUF, - M_ZERO | (cold ? M_NOWAIT : M_WAITOK)); - - if (scr == NULL) - return NULL; - + scr = malloc(sizeof *scr, M_DEVBUF, M_ZERO | M_WAITOK); scr->nsegs = 0; scr->depth = depth; scr->stride = virtual_width * depth / 8; diff --git a/sys/arch/arm/s3c2xx0/s3c2800_pci.c b/sys/arch/arm/s3c2xx0/s3c2800_pci.c index 715ce6b7f6eb..fef26e3ba426 100644 --- a/sys/arch/arm/s3c2xx0/s3c2800_pci.c +++ b/sys/arch/arm/s3c2xx0/s3c2800_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: s3c2800_pci.c,v 1.26 2018/11/26 12:21:51 jmcneill Exp $ */ +/* $NetBSD: s3c2800_pci.c,v 1.27 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2002 Fujitsu Component Limited @@ -100,7 +100,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: s3c2800_pci.c,v 1.26 2018/11/26 12:21:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: s3c2800_pci.c,v 1.27 2019/11/10 21:16:24 chs Exp $"); #include "opt_pci.h" #include "pci.h" @@ -519,10 +519,7 @@ s3c2800_pci_intr_establish(void *pcv, pci_intr_handle_t ih, int level, "func=%p, arg=%p, xname=%s)\n", pcv, ih, level, func, arg, xname); #endif - handler = malloc(sizeof *handler, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (handler == NULL) - panic("sspci_intr_establish: can't malloc handler info"); - + handler = malloc(sizeof *handler, M_DEVBUF, M_WAITOK); handler->func = func; handler->arg = arg; handler->level = level; diff --git a/sys/arch/arm/s3c2xx0/sscom.c b/sys/arch/arm/s3c2xx0/sscom.c index a049f9cf0ffe..35979c3ab73e 100644 --- a/sys/arch/arm/s3c2xx0/sscom.c +++ b/sys/arch/arm/s3c2xx0/sscom.c @@ -1,4 +1,4 @@ -/* $NetBSD: sscom.c,v 1.47 2015/04/13 21:18:41 riastradh Exp $ */ +/* $NetBSD: sscom.c,v 1.48 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2002, 2003 Fujitsu Component Limited @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.47 2015/04/13 21:18:41 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.48 2019/11/10 21:16:24 chs Exp $"); #include "opt_sscom.h" #include "opt_ddb.h" @@ -481,14 +481,9 @@ sscom_attach_subr(struct sscom_softc *sc) tp->t_hwiflow = sscomhwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(sscom_rbuf_size << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(sscom_rbuf_size << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = sscom_rbuf_size; - if (sc->sc_rbuf == NULL) { - printf("%s: unable to allocate ring buffer\n", - device_xname(sc->sc_dev)); - return; - } sc->sc_ebuf = sc->sc_rbuf + (sscom_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/arm/sa11x0/sa1111.c b/sys/arch/arm/sa11x0/sa1111.c index ceb1de91d133..4a407aa6b770 100644 --- a/sys/arch/arm/sa11x0/sa1111.c +++ b/sys/arch/arm/sa11x0/sa1111.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa1111.c,v 1.24 2011/07/01 20:31:39 dyoung Exp $ */ +/* $NetBSD: sa1111.c,v 1.25 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa1111.c,v 1.24 2011/07/01 20:31:39 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa1111.c,v 1.25 2019/11/10 21:16:24 chs Exp $"); #include #include @@ -124,10 +124,7 @@ sacc_intr_establish(sacc_chipset_tag_t *ic, int irq, int type, int level, struct sacc_softc *sc = (struct sacc_softc *)ic; struct sacc_intrhand **p, *ih; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("sacc_intr_establish: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); if (irq < 0 || irq > SACCIC_LEN || !(type == IST_EDGE_RAISE || type == IST_EDGE_FALL)) diff --git a/sys/arch/arm/sa11x0/sa11x0_com.c b/sys/arch/arm/sa11x0/sa11x0_com.c index c298ed136506..98503a49cb08 100644 --- a/sys/arch/arm/sa11x0/sa11x0_com.c +++ b/sys/arch/arm/sa11x0/sa11x0_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_com.c,v 1.56 2018/09/21 12:04:07 skrll Exp $ */ +/* $NetBSD: sa11x0_com.c,v 1.57 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.56 2018/09/21 12:04:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.57 2019/11/10 21:16:24 chs Exp $"); #include "opt_com.h" #include "opt_console.h" @@ -311,13 +311,9 @@ sacom_attach_subr(struct sacom_softc *sc) tp->t_hwiflow = sacomhwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(SACOM_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(SACOM_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = SACOM_RING_SIZE; - if (sc->sc_rbuf == NULL) { - aprint_normal_dev(sc->sc_dev, "unable to allocate ring buffer\n"); - return; - } sc->sc_ebuf = sc->sc_rbuf + (SACOM_RING_SIZE << 1); sc->sc_tbc = 0; diff --git a/sys/arch/arm/sa11x0/sa11x0_irqhandler.c b/sys/arch/arm/sa11x0/sa11x0_irqhandler.c index 91e579aed15f..7dcd3e46d46f 100644 --- a/sys/arch/arm/sa11x0/sa11x0_irqhandler.c +++ b/sys/arch/arm/sa11x0/sa11x0_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_irqhandler.c,v 1.18 2012/09/01 14:48:05 matt Exp $ */ +/* $NetBSD: sa11x0_irqhandler.c,v 1.19 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: sa11x0_irqhandler.c,v 1.18 2012/09/01 14:48:05 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_irqhandler.c,v 1.19 2019/11/10 21:16:24 chs Exp $"); #include "opt_irqstats.h" @@ -167,10 +167,7 @@ sa11x0_intr_establish(sa11x0_chipset_tag_t ic, int irq, int type, int level, struct irqhandler **p, *q, *ih; static struct irqhandler fakehand = {fakeintr}; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("sa11x0_intr_establish: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); if (irq < 0 || irq >= ICU_LEN || type == IST_NONE) panic("intr_establish: bogus irq or type"); diff --git a/sys/arch/arm/xilinx/zynq_uart.c b/sys/arch/arm/xilinx/zynq_uart.c index ef5cc7ca58ba..57bd7467a4fb 100644 --- a/sys/arch/arm/xilinx/zynq_uart.c +++ b/sys/arch/arm/xilinx/zynq_uart.c @@ -1,4 +1,4 @@ -/* $NetBSD: zynq_uart.c,v 1.1 2019/06/11 13:01:48 skrll Exp $ */ +/* $NetBSD: zynq_uart.c,v 1.2 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2012 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.1 2019/06/11 13:01:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.2 2019/11/10 21:16:24 chs Exp $"); #include "opt_soc.h" #include "opt_console.h" @@ -413,15 +413,9 @@ zynquart_attach_common(device_t parent, device_t self, sc->sc_tty = tp; sc->sc_rbuf = malloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); sc->sc_rbuf_size = zynquart_rbuf_size; sc->sc_rbuf_in = sc->sc_rbuf_out = 0; - if (sc->sc_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate ring buffer\n"); - return; - } - sc->sc_txfifo_len = 64; sc->sc_txfifo_thresh = 32; diff --git a/sys/arch/arm/xscale/becc_icu.c b/sys/arch/arm/xscale/becc_icu.c index 66aaf2c06e98..a23140ebccbf 100644 --- a/sys/arch/arm/xscale/becc_icu.c +++ b/sys/arch/arm/xscale/becc_icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: becc_icu.c,v 1.13 2012/08/02 15:56:07 skrll Exp $ */ +/* $NetBSD: becc_icu.c,v 1.14 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: becc_icu.c,v 1.13 2012/08/02 15:56:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: becc_icu.c,v 1.14 2019/11/10 21:16:24 chs Exp $"); #ifndef EVBARM_SPL_NOINLINE #define EVBARM_SPL_NOINLINE @@ -293,10 +293,7 @@ becc_intr_establish(int irq, int ipl, int (*func)(void *), void *arg) if (irq < 0 || irq > NIRQ) panic("becc_intr_establish: IRQ %d out of range", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/arm/xscale/i80321_icu.c b/sys/arch/arm/xscale/i80321_icu.c index 86dbe9137610..db79a816e3a2 100644 --- a/sys/arch/arm/xscale/i80321_icu.c +++ b/sys/arch/arm/xscale/i80321_icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: i80321_icu.c,v 1.24 2012/08/02 15:56:07 skrll Exp $ */ +/* $NetBSD: i80321_icu.c,v 1.25 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.24 2012/08/02 15:56:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.25 2019/11/10 21:16:24 chs Exp $"); #ifndef EVBARM_SPL_NOINLINE #define EVBARM_SPL_NOINLINE @@ -309,10 +309,7 @@ i80321_intr_establish(int irq, int ipl, int (*func)(void *), void *arg) if (irq < 0 || irq > NIRQ) panic("i80321_intr_establish: IRQ %d out of range", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/arm/xscale/ixp425_if_npe.c b/sys/arch/arm/xscale/ixp425_if_npe.c index ed05a970f8cd..d1e705f130a2 100644 --- a/sys/arch/arm/xscale/ixp425_if_npe.c +++ b/sys/arch/arm/xscale/ixp425_if_npe.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_if_npe.c,v 1.42 2019/09/13 07:55:06 msaitoh Exp $ */ +/* $NetBSD: ixp425_if_npe.c,v 1.43 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 2006 Sam Leffler. All rights reserved. @@ -28,7 +28,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.42 2019/09/13 07:55:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.43 2019/11/10 21:16:24 chs Exp $"); /* * Intel XScale NPE Ethernet driver. @@ -465,23 +465,13 @@ npe_dma_setup(struct npe_softc *sc, struct npedma *dma, aprint_error_dev(sc->sc_dev, "unable to %s for %s %s buffers, error %u\n", "load map", dma->name, "h/w", error); - destroy_dmamap: bus_dmamap_destroy(sc->sc_dt, dma->buf_map); goto unmap_dmamem; } /* XXX M_TEMP */ dma->buf = malloc(nbuf * sizeof(struct npebuf), M_TEMP, - M_NOWAIT | M_ZERO); - if (dma->buf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to %s for %s %s buffers, error %u\n", - "allocate memory", dma->name, "h/w", error); - bus_dmamap_unload(sc->sc_dt, dma->buf_map); - error = ENOMEM; - goto destroy_dmamap; - } - + M_WAITOK | M_ZERO); dma->buf_phys = dma->buf_map->dm_segs[0].ds_addr; for (i = 0; i < dma->nbuf; i++) { struct npebuf *npe = &dma->buf[i]; diff --git a/sys/arch/arm/xscale/ixp425_intr.c b/sys/arch/arm/xscale/ixp425_intr.c index 948fd389044e..6c7f849911c5 100644 --- a/sys/arch/arm/xscale/ixp425_intr.c +++ b/sys/arch/arm/xscale/ixp425_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_intr.c,v 1.26 2014/03/26 08:52:00 christos Exp $ */ +/* $NetBSD: ixp425_intr.c,v 1.27 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2003 @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixp425_intr.c,v 1.26 2014/03/26 08:52:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_intr.c,v 1.27 2019/11/10 21:16:24 chs Exp $"); #ifndef EVBARM_SPL_NOINLINE #define EVBARM_SPL_NOINLINE @@ -343,10 +343,7 @@ ixp425_intr_establish(int irq, int ipl, int (*func)(void *), void *arg) irq, ipl, (uint32_t) func, (uint32_t) arg); #endif - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/arm/xscale/ixp425_qmgr.c b/sys/arch/arm/xscale/ixp425_qmgr.c index 041beab57481..bde6856ac52e 100644 --- a/sys/arch/arm/xscale/ixp425_qmgr.c +++ b/sys/arch/arm/xscale/ixp425_qmgr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_qmgr.c,v 1.8 2019/06/03 06:04:20 msaitoh Exp $ */ +/* $NetBSD: ixp425_qmgr.c,v 1.9 2019/11/10 21:16:24 chs Exp $ */ /*- * Copyright (c) 2006 Sam Leffler, Errno Consulting @@ -60,7 +60,7 @@ */ #include /*__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_qmgr.c,v 1.1 2006/11/19 23:55:23 sam Exp $");*/ -__KERNEL_RCSID(0, "$NetBSD: ixp425_qmgr.c,v 1.8 2019/06/03 06:04:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_qmgr.c,v 1.9 2019/11/10 21:16:24 chs Exp $"); /* * Intel XScale Queue Manager support. @@ -229,10 +229,7 @@ ixpqmgr_init(bus_space_tag_t iot) sc->sc_dev = dev; sc->sc_iot = sa->sc_iot; #else - sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc == NULL) - return (NULL); - + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_iot = iot; #endif diff --git a/sys/arch/arm/xscale/pxa2x0_gpio.c b/sys/arch/arm/xscale/pxa2x0_gpio.c index d731e800b893..c643dbe2e004 100644 --- a/sys/arch/arm/xscale/pxa2x0_gpio.c +++ b/sys/arch/arm/xscale/pxa2x0_gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_gpio.c,v 1.17 2017/06/16 22:39:34 pgoyette Exp $ */ +/* $NetBSD: pxa2x0_gpio.c,v 1.18 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.17 2017/06/16 22:39:34 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.18 2019/11/10 21:16:24 chs Exp $"); #include "gpio.h" #include "opt_pxa2x0_gpio.h" @@ -280,8 +280,7 @@ pxa2x0_gpio_intr_establish(u_int gpio, int level, int spl, int (*func)(void *), if (sc->sc_handlers[gpio] != NULL) panic("pxa2x0_gpio_intr_establish: illegal shared interrupt"); - gh = malloc(sizeof(struct gpio_irq_handler), M_DEVBUF, M_NOWAIT); - + gh = malloc(sizeof(struct gpio_irq_handler), M_DEVBUF, M_WAITOK); gh->gh_func = func; gh->gh_arg = arg; gh->gh_spl = spl; diff --git a/sys/arch/arm/xscale/pxa2x0_lcd.c b/sys/arch/arm/xscale/pxa2x0_lcd.c index c8ab25edeb65..48870dcbbdb1 100644 --- a/sys/arch/arm/xscale/pxa2x0_lcd.c +++ b/sys/arch/arm/xscale/pxa2x0_lcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_lcd.c,v 1.36 2015/10/17 16:34:43 jmcneill Exp $ */ +/* $NetBSD: pxa2x0_lcd.c,v 1.37 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2002 Genetec Corporation. All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.36 2015/10/17 16:34:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.37 2019/11/10 21:16:24 chs Exp $"); #include "opt_pxa2x0_lcd.h" @@ -515,12 +515,7 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *sc, int depth, return EINVAL; } - scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); - if (scr == NULL) - return ENOMEM; - - memset(scr, 0, sizeof(*scr)); - + scr = malloc(sizeof(*scr), M_DEVBUF, M_WAITOK | M_ZERO); scr->nsegs = 0; scr->depth = depth; scr->buf_size = size; diff --git a/sys/arch/arm/zynq/zynq_uart.c b/sys/arch/arm/zynq/zynq_uart.c index 696db74b91da..df897c169437 100644 --- a/sys/arch/arm/zynq/zynq_uart.c +++ b/sys/arch/arm/zynq/zynq_uart.c @@ -1,4 +1,4 @@ -/* $NetBSD: zynq_uart.c,v 1.2 2015/04/13 21:18:41 riastradh Exp $ */ +/* $NetBSD: zynq_uart.c,v 1.3 2019/11/10 21:16:24 chs Exp $ */ /* * Copyright (c) 2012 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.2 2015/04/13 21:18:41 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.3 2019/11/10 21:16:24 chs Exp $"); #include "opt_zynq.h" #include "opt_zynquart.h" @@ -423,15 +423,9 @@ zynquart_attach_common(device_t parent, device_t self, sc->sc_tty = tp; sc->sc_rbuf = malloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size, - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); sc->sc_rbuf_size = zynquart_rbuf_size; sc->sc_rbuf_in = sc->sc_rbuf_out = 0; - if (sc->sc_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate ring buffer\n"); - return; - } - sc->sc_txfifo_len = 64; sc->sc_txfifo_thresh = 32; diff --git a/sys/arch/atari/atari/be_bus.c b/sys/arch/atari/atari/be_bus.c index 005a2f737f04..80cb52eea3d3 100644 --- a/sys/arch/atari/atari/be_bus.c +++ b/sys/arch/atari/atari/be_bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: be_bus.c,v 1.15 2011/07/01 20:34:05 dyoung Exp $ */ +/* $NetBSD: be_bus.c,v 1.16 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.15 2011/07/01 20:34:05 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.16 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -183,8 +183,7 @@ beb_alloc_bus_space_tag(bus_space_tag_t storage) if (storage != NULL) beb_t = storage; else { - if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL) - return NULL; + beb_t = malloc(sizeof(*beb_t), M_TEMP, M_WAITOK); } memset(beb_t, 0, sizeof(*beb_t)); diff --git a/sys/arch/atari/atari/intr.c b/sys/arch/atari/atari/intr.c index cb9beb9780e5..ab5df8f5b5b6 100644 --- a/sys/arch/atari/atari/intr.c +++ b/sys/arch/atari/atari/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.26 2014/10/18 08:33:24 snj Exp $ */ +/* $NetBSD: intr.c,v 1.27 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2014/10/18 08:33:24 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.27 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -113,13 +113,7 @@ intr_establish(int vector, int type, int pri, hw_ifun_t ih_fun, void *ih_arg) int s; /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("intr_establish: can't malloc handler info"); - - /* - * Initialize vector info - */ + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; ih->ih_type = type; diff --git a/sys/arch/atari/atari/le_bus.c b/sys/arch/atari/atari/le_bus.c index 9c8e8251c017..40d12a1617ec 100644 --- a/sys/arch/atari/atari/le_bus.c +++ b/sys/arch/atari/atari/le_bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: le_bus.c,v 1.19 2016/10/13 06:48:07 maya Exp $ */ +/* $NetBSD: le_bus.c,v 1.20 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.19 2016/10/13 06:48:07 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.20 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -267,8 +267,7 @@ leb_alloc_bus_space_tag(bus_space_tag_t storage) if (storage != NULL) leb_t = storage; else { - if ((leb_t = malloc(sizeof(*leb_t), M_TEMP, M_NOWAIT)) == NULL) - return NULL; + leb_t = malloc(sizeof(*leb_t), M_TEMP, M_WAITOK); } memset(leb_t, 0, sizeof(*leb_t)); diff --git a/sys/arch/atari/atari/mainbus.c b/sys/arch/atari/atari/mainbus.c index 2cb209258cd8..09ba3a8f2ca4 100644 --- a/sys/arch/atari/atari/mainbus.c +++ b/sys/arch/atari/atari/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.11 2011/07/01 20:34:05 dyoung Exp $ */ +/* $NetBSD: mainbus.c,v 1.12 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2011/07/01 20:34:05 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -168,10 +168,7 @@ mb_alloc_bus_space_tag(void) bus_space_tag_t mb_t; /* Not really M_TEMP, is it.. */ - mb_t = malloc(sizeof(*mb_t), M_TEMP, M_NOWAIT|M_ZERO); - if (mb_t == NULL) - return NULL; - + mb_t = malloc(sizeof(*mb_t), M_TEMP, M_WAITOK|M_ZERO); mb_t->abs_p_1 = mb_bus_space_peek_1; mb_t->abs_p_2 = mb_bus_space_peek_2; mb_t->abs_p_4 = mb_bus_space_peek_4; diff --git a/sys/arch/atari/dev/hdfd.c b/sys/arch/atari/dev/hdfd.c index caf9922757eb..4800da6d169c 100644 --- a/sys/arch/atari/dev/hdfd.c +++ b/sys/arch/atari/dev/hdfd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hdfd.c,v 1.85 2019/06/29 16:41:18 tsutsui Exp $ */ +/* $NetBSD: hdfd.c,v 1.86 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1996 Leo Weppelman @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.85 2019/06/29 16:41:18 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.86 2019/11/10 21:16:25 chs Exp $"); #include "opt_ddb.h" @@ -1427,10 +1427,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == 0) - return ENOMEM; - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/bebox/bebox/mainbus.c b/sys/arch/bebox/bebox/mainbus.c index e62cb36f574a..7061808d76cf 100644 --- a/sys/arch/bebox/bebox/mainbus.c +++ b/sys/arch/bebox/bebox/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.29 2012/01/27 18:52:52 para Exp $ */ +/* $NetBSD: mainbus.c,v 1.30 2019/11/10 21:16:25 chs Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.29 2012/01/27 18:52:52 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -121,13 +121,11 @@ mainbus_attach(device_t parent, device_t self, void *aux) #if NPCI > 0 genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_NOWAIT); - KASSERT(genppc_pct != NULL); + M_WAITOK); bebox_pci_get_chipset_tag(genppc_pct); pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); diff --git a/sys/arch/bebox/bebox/pic_bebox.c b/sys/arch/bebox/bebox/pic_bebox.c index 97d0973906d2..22f6a1b7270f 100644 --- a/sys/arch/bebox/bebox/pic_bebox.c +++ b/sys/arch/bebox/bebox/pic_bebox.c @@ -1,4 +1,4 @@ -/* $NetBSD: pic_bebox.c,v 1.10 2012/10/20 14:56:31 kiyohara Exp $ */ +/* $NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.10 2012/10/20 14:56:31 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $"); #include "opt_multiprocessor.h" @@ -57,9 +57,7 @@ setup_bebox_intr(void) { struct pic_ops *pic; - pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_NOWAIT); - KASSERT(pic != NULL); - + pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK); pic->pic_numintrs = 32; pic->pic_cookie = (void *)BEBOX_REG; pic->pic_enable_irq = bebox_enable_irq; diff --git a/sys/arch/cesfic/cesfic/isr.c b/sys/arch/cesfic/cesfic/isr.c index 25f60e1bebcd..7449b4ece710 100644 --- a/sys/arch/cesfic/cesfic/isr.c +++ b/sys/arch/cesfic/cesfic/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.16 2010/12/20 00:25:30 matt Exp $ */ +/* $NetBSD: isr.c,v 1.17 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.16 2010/12/20 00:25:30 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.17 2019/11/10 21:16:25 chs Exp $"); #include #include @@ -76,11 +76,7 @@ isrlink(int (*func)(void *), void *arg, int ipl, int priority) if ((ipl < 0) || (ipl >= NISR)) panic("isrlink: bad ipl %d", ipl); - newisr = (struct isr *)malloc(sizeof(struct isr), M_DEVBUF, M_NOWAIT); - if (newisr == NULL) - panic("isrlink: can't allocate space for isr"); - - /* Fill in the new entry. */ + newisr = malloc(sizeof(struct isr), M_DEVBUF, M_WAITOK); newisr->isr_func = func; newisr->isr_arg = arg; newisr->isr_ipl = ipl; diff --git a/sys/arch/cesfic/dev/zs.c b/sys/arch/cesfic/dev/zs.c index 9ab6b734d4af..aa354cbc83b2 100644 --- a/sys/arch/cesfic/dev/zs.c +++ b/sys/arch/cesfic/dev/zs.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs.c,v 1.19 2014/03/24 18:56:43 christos Exp $ */ +/* $NetBSD: zs.c,v 1.20 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.19 2014/03/24 18:56:43 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.20 2019/11/10 21:16:25 chs Exp $"); #include "opt_ddb.h" @@ -124,7 +124,7 @@ zs_config(struct zsc_softc *zsc, char *base) cs = &zs_conschan_store; } else { cs = malloc(sizeof(struct zs_chanstate), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); if(channel==0){ cs->cs_reg_csr = base + 7; cs->cs_reg_data = base + 15; diff --git a/sys/arch/cobalt/cobalt/interrupt.c b/sys/arch/cobalt/cobalt/interrupt.c index a7232af93371..46f949f1c81c 100644 --- a/sys/arch/cobalt/cobalt/interrupt.c +++ b/sys/arch/cobalt/cobalt/interrupt.c @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.9 2018/06/06 01:49:07 maya Exp $ */ +/* $NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 2006 Izumi Tsutsui. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.9 2018/06/06 01:49:07 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:25 chs Exp $"); #define __INTR_PRIVATE @@ -265,10 +265,7 @@ icu_intr_establish(int irq, int type, int ipl, int (*func)(void *), void *arg) return NULL; } - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/epoc32/windermere/wmcom.c b/sys/arch/epoc32/windermere/wmcom.c index 6bfdc77471e6..3f60f860149b 100644 --- a/sys/arch/epoc32/windermere/wmcom.c +++ b/sys/arch/epoc32/windermere/wmcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: wmcom.c,v 1.7 2018/09/03 16:29:24 riastradh Exp $ */ +/* $NetBSD: wmcom.c,v 1.8 2019/11/10 21:16:25 chs Exp $ */ /* * Copyright (c) 2012 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: wmcom.c,v 1.7 2018/09/03 16:29:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wmcom.c,v 1.8 2019/11/10 21:16:25 chs Exp $"); #include "rnd.h" @@ -199,11 +199,7 @@ wmcom_attach(device_t parent, device_t self, void *aux) sc->sc_tty->t_hwiflow = wmcom_hwiflow; sc->sc_tbc = 0; - sc->sc_rbuf = malloc(WMCOM_RING_SIZE << 1, M_DEVBUF, M_NOWAIT); - if (sc->sc_rbuf == NULL) { - aprint_error_dev(self, "unable to allocate ring buffer\n"); - return; - } + sc->sc_rbuf = malloc(WMCOM_RING_SIZE << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = WMCOM_RING_SIZE; diff --git a/sys/arch/evbarm/dev/plcom.c b/sys/arch/evbarm/dev/plcom.c index 0d25488aea03..487817b844c8 100644 --- a/sys/arch/evbarm/dev/plcom.c +++ b/sys/arch/evbarm/dev/plcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: plcom.c,v 1.59 2019/07/23 15:56:14 jmcneill Exp $ */ +/* $NetBSD: plcom.c,v 1.60 2019/11/10 21:16:25 chs Exp $ */ /*- * Copyright (c) 2001 ARM Ltd @@ -94,7 +94,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.59 2019/07/23 15:56:14 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.60 2019/11/10 21:16:25 chs Exp $"); #include "opt_plcom.h" #include "opt_ddb.h" @@ -514,14 +514,9 @@ plcom_attach_subr(struct plcom_softc *sc) tp->t_hwiflow = plcomhwiflow; sc->sc_tty = tp; - sc->sc_rbuf = malloc(plcom_rbuf_size << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(plcom_rbuf_size << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = plcom_rbuf_size; - if (sc->sc_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate ring buffer\n"); - return; - } sc->sc_ebuf = sc->sc_rbuf + (plcom_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/evbarm/ifpga/ifpga_intr.c b/sys/arch/evbarm/ifpga/ifpga_intr.c index 0870876a259b..3f7a43e28f3b 100644 --- a/sys/arch/evbarm/ifpga/ifpga_intr.c +++ b/sys/arch/evbarm/ifpga/ifpga_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ifpga_intr.c,v 1.10 2015/02/09 21:56:20 skrll Exp $ */ +/* $NetBSD: ifpga_intr.c,v 1.11 2019/11/10 21:16:25 chs Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -255,10 +255,7 @@ ifpga_intr_establish(int irq, int ipl, int (*func)(void *), void *arg) if (irq < 0 || irq > NIRQ) panic("ifpga_intr_establish: IRQ %d out of range", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/evbarm/iq80310/iq80310_intr.c b/sys/arch/evbarm/iq80310/iq80310_intr.c index ffdbae7feed4..13d06b2e9c47 100644 --- a/sys/arch/evbarm/iq80310/iq80310_intr.c +++ b/sys/arch/evbarm/iq80310/iq80310_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: iq80310_intr.c,v 1.34 2014/03/26 17:40:03 christos Exp $ */ +/* $NetBSD: iq80310_intr.c,v 1.35 2019/11/10 21:16:26 chs Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.34 2014/03/26 17:40:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.35 2019/11/10 21:16:26 chs Exp $"); #ifndef EVBARM_SPL_NOINLINE #define EVBARM_SPL_NOINLINE @@ -373,10 +373,7 @@ iq80310_intr_establish(int irq, int ipl, int (*func)(void *), void *arg) if (irq < 0 || irq > NIRQ) panic("iq80310_intr_establish: IRQ %d out of range", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = ipl; diff --git a/sys/arch/evbarm/mini2440/mini2440_machdep.c b/sys/arch/evbarm/mini2440/mini2440_machdep.c index fd3e8cd45f3b..171c761d05ee 100644 --- a/sys/arch/evbarm/mini2440/mini2440_machdep.c +++ b/sys/arch/evbarm/mini2440/mini2440_machdep.c @@ -131,7 +131,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mini2440_machdep.c,v 1.15 2019/07/16 14:41:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mini2440_machdep.c,v 1.16 2019/11/10 21:16:26 chs Exp $"); #include "opt_arm_debug.h" #include "opt_console.h" @@ -1026,9 +1026,7 @@ s3c2xx0_bus_dma_init(struct arm32_bus_dma_tag *dma_tag_template) #if 1 dmat = dma_tag_template; #else - dmat = malloc(sizeof *dmat, M_DEVBUF, M_NOWAIT); - if (dmat == NULL) - return NULL; + dmat = malloc(sizeof *dmat, M_DEVBUF, M_WAITOK); *dmat = *dma_tag_template; #endif diff --git a/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c b/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c index e6b6f88b88f7..650132137fb2 100644 --- a/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c +++ b/sys/arch/evbarm/smdk2xx0/smdk2410_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: smdk2410_machdep.c,v 1.41 2019/07/16 14:41:48 skrll Exp $ */ +/* $NetBSD: smdk2410_machdep.c,v 1.42 2019/11/10 21:16:26 chs Exp $ */ /* * Copyright (c) 2002, 2003 Fujitsu Component Limited @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smdk2410_machdep.c,v 1.41 2019/07/16 14:41:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smdk2410_machdep.c,v 1.42 2019/11/10 21:16:26 chs Exp $"); #include "opt_arm_debug.h" #include "opt_console.h" @@ -993,9 +993,7 @@ s3c2xx0_bus_dma_init(struct arm32_bus_dma_tag *dma_tag_template) #if 1 dmat = dma_tag_template; #else - dmat = malloc(sizeof *dmat, M_DEVBUF, M_NOWAIT); - if (dmat == NULL) - return NULL; + dmat = malloc(sizeof *dmat, M_DEVBUF, M_WAITOK); *dmat = *dma_tag_template; #endif diff --git a/sys/arch/evbmips/gdium/gdium_intr.c b/sys/arch/evbmips/gdium/gdium_intr.c index 97c8eabd774c..808344228753 100644 --- a/sys/arch/evbmips/gdium/gdium_intr.c +++ b/sys/arch/evbmips/gdium/gdium_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: gdium_intr.c,v 1.8 2016/08/26 15:45:47 skrll Exp $ */ +/* $NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.8 2016/08/26 15:45:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $"); #define __INTR_PRIVATE @@ -239,10 +239,7 @@ evbmips_intr_establish(int irq, int (*func)(void *), void *arg) KASSERT(irq == irqmap->irqidx); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT|M_ZERO); - if (ih == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/evbmips/loongson/loongson_intr.c b/sys/arch/evbmips/loongson/loongson_intr.c index 14c65632c183..b5753be52346 100644 --- a/sys/arch/evbmips/loongson/loongson_intr.c +++ b/sys/arch/evbmips/loongson/loongson_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: loongson_intr.c,v 1.6 2016/08/27 05:53:40 skrll Exp $ */ +/* $NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.6 2016/08/27 05:53:40 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $"); #define __INTR_PRIVATE @@ -295,10 +295,7 @@ evbmips_intr_establish(int irq, int (*func)(void *), void *arg) KASSERT(irq < BONITO_NINTS); DPRINTF(("loongson_intr_establish %d %p", irq, func)); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT|M_ZERO); - if (ih == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/evbmips/malta/malta_intr.c b/sys/arch/evbmips/malta/malta_intr.c index 762192d9cad0..42202ffa1127 100644 --- a/sys/arch/evbmips/malta/malta_intr.c +++ b/sys/arch/evbmips/malta/malta_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: malta_intr.c,v 1.25 2016/08/26 15:45:48 skrll Exp $ */ +/* $NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.25 2016/08/26 15:45:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $"); #define __INTR_PRIVATE @@ -206,10 +206,7 @@ evbmips_intr_establish(int irq, int (*func)(void *), void *arg) struct evbmips_intrhand *ih; int s; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; diff --git a/sys/arch/evbmips/malta/pci/pcib.c b/sys/arch/evbmips/malta/pci/pcib.c index 83e9408719ff..b7c7af158fc7 100644 --- a/sys/arch/evbmips/malta/pci/pcib.c +++ b/sys/arch/evbmips/malta/pci/pcib.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcib.c,v 1.18 2014/03/29 19:28:28 christos Exp $ */ +/* $NetBSD: pcib.c,v 1.19 2019/11/10 21:16:26 chs Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.18 2014/03/29 19:28:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2019/11/10 21:16:26 chs Exp $"); #include #include @@ -508,10 +508,7 @@ pcib_isa_intr_establish(void *v, int irq, int type, int level, return (NULL); } - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c b/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c index 4d213fb808b6..37cbc863fccb 100644 --- a/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c +++ b/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpc_mainbus.c,v 1.6 2011/07/01 19:03:09 dyoung Exp $ */ +/* $NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.6 2011/07/01 19:03:09 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $"); #include #include @@ -79,11 +79,10 @@ cpc_mainbus_attach(device_t parent, device_t self, void *aux) struct genppc_pci_chipset_businfo *pbi; genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_NOWAIT); + M_WAITOK); pmppc_pci_get_chipset_tag(genppc_pct); pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); SIMPLEQ_INIT(&genppc_pct->pc_pbi); diff --git a/sys/arch/evbppc/pmppc/pic_cpc700.c b/sys/arch/evbppc/pmppc/pic_cpc700.c index c4e82c3fec1e..04b6f8a3d9f4 100644 --- a/sys/arch/evbppc/pmppc/pic_cpc700.c +++ b/sys/arch/evbppc/pmppc/pic_cpc700.c @@ -1,4 +1,4 @@ -/* $NetBSD: pic_cpc700.c,v 1.6 2011/07/01 19:03:09 dyoung Exp $ */ +/* $NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.6 2011/07/01 19:03:09 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $"); #include #include @@ -60,8 +60,7 @@ setup_cpc700(void) struct cpc700_ops *cpc700; struct pic_ops *pic; - cpc700 = malloc(sizeof(struct cpc700_ops), M_DEVBUF, M_NOWAIT); - KASSERT(cpc700 != NULL); + cpc700 = malloc(sizeof(struct cpc700_ops), M_DEVBUF, M_WAITOK); pic = &cpc700->pic; pic->pic_numintrs = 32; diff --git a/sys/arch/evbppc/virtex/design_gsrd1.c b/sys/arch/evbppc/virtex/design_gsrd1.c index 772caebfd722..f73eb0f49a31 100644 --- a/sys/arch/evbppc/virtex/design_gsrd1.c +++ b/sys/arch/evbppc/virtex/design_gsrd1.c @@ -1,4 +1,4 @@ -/* $NetBSD: design_gsrd1.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */ +/* $NetBSD: design_gsrd1.c,v 1.4 2019/11/10 21:16:27 chs Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: design_gsrd1.c,v 1.3 2011/06/18 06:44:27 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: design_gsrd1.c,v 1.4 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -373,11 +373,7 @@ ll_dmac_intr_establish(int chan, void (*func)(void *), void *arg) if (cdmac_intrs[chan] != NULL) return (NULL); - ih = malloc(sizeof(struct cdmac_intr_handle), M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(struct cdmac_intr_handle), M_DEVBUF, M_WAITOK); ih->cih_func = func; ih->cih_arg = arg; diff --git a/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c b/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c index 7e1ba39eb21d..0f3d9971e5a0 100644 --- a/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c +++ b/sys/arch/evbsh3/ap_ms104_sh4/ap_ms104_sh4_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ap_ms104_sh4_intr.c,v 1.2 2012/01/21 19:44:29 nonaka Exp $ */ +/* $NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (C) 2009 NONAKA Kimihiro @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.2 2012/01/21 19:44:29 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -102,9 +102,7 @@ extintr_establish(int irq, int trigger, int level, KDASSERT(irq >= 1 && irq <= 14); - ih = malloc(sizeof(*ih), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("intr_establish: can't malloc handler info"); + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); s = _cpu_intr_suspend(); diff --git a/sys/arch/ews4800mips/sbd/fb_sbdio.c b/sys/arch/ews4800mips/sbd/fb_sbdio.c index 2e6678aba26a..2b28aca4525c 100644 --- a/sys/arch/ews4800mips/sbd/fb_sbdio.c +++ b/sys/arch/ews4800mips/sbd/fb_sbdio.c @@ -1,4 +1,4 @@ -/* $NetBSD: fb_sbdio.c,v 1.16 2017/06/13 19:13:55 spz Exp $ */ +/* $NetBSD: fb_sbdio.c,v 1.17 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define WIRED_FB_TLB #include -__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.16 2017/06/13 19:13:55 spz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.17 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -146,17 +146,8 @@ fb_sbdio_attach(device_t parent, device_t self, void *aux) sc->sc_nscreens = 1; } else { ri = malloc(sizeof(struct rasops_info), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (ri == NULL) { - printf(":can't allocate rasops memory\n"); - return; - } - ga = malloc(sizeof(struct ga), M_DEVBUF, M_NOWAIT | M_ZERO); - if (ga == NULL) { - printf(":can't allocate ga memory\n"); - free(ri, M_DEVBUF); - return; - } + M_WAITOK | M_ZERO); + ga = malloc(sizeof(struct ga), M_DEVBUF, M_WAITOK | M_ZERO); ga->reg_paddr = sa->sa_addr2; ga->flags = sa->sa_flags; fb_pmap_enter(sa->sa_addr1, sa->sa_addr2, diff --git a/sys/arch/hp300/dev/hpib.c b/sys/arch/hp300/dev/hpib.c index aad8a987e417..9bd764f087ca 100644 --- a/sys/arch/hp300/dev/hpib.c +++ b/sys/arch/hp300/dev/hpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpib.c,v 1.39 2012/10/13 06:12:23 tsutsui Exp $ */ +/* $NetBSD: hpib.c,v 1.40 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.39 2012/10/13 06:12:23 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.40 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -161,11 +161,7 @@ hpibbusattach(device_t parent, device_t self, void *aux) /* * Initialize the DMA queue entry. */ - sc->sc_dq = malloc(sizeof(struct dmaqueue), M_DEVBUF, M_NOWAIT); - if (sc->sc_dq == NULL) { - aprint_error_dev(self, "can't allocate DMA queue entry\n"); - return; - } + sc->sc_dq = malloc(sizeof(struct dmaqueue), M_DEVBUF, M_WAITOK); sc->sc_dq->dq_softc = sc; sc->sc_dq->dq_start = hpibstart; sc->sc_dq->dq_done = hpibdone; diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c index 86fb23d36a9b..1d83e9e2ee32 100644 --- a/sys/arch/hp300/hp300/autoconf.c +++ b/sys/arch/hp300/hp300/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $ */ +/* $NetBSD: autoconf.c,v 1.107 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.106 2019/06/29 02:41:17 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.107 2019/11/10 21:16:27 chs Exp $"); #include "dvbox.h" #include "gbox.h" @@ -395,10 +395,7 @@ device_register(device_t dev, void *aux) * we can mount as root. */ - dd = malloc(sizeof(struct dev_data), M_DEVBUF, M_NOWAIT | M_ZERO); - if (dd == NULL) - panic("device_register: can't allocate dev_data"); - + dd = malloc(sizeof(struct dev_data), M_DEVBUF, M_WAITOK | M_ZERO); dd->dd_dev = dev; /* diff --git a/sys/arch/hp300/hp300/intr.c b/sys/arch/hp300/hp300/intr.c index 237da930a50a..a64a3456cfd9 100644 --- a/sys/arch/hp300/hp300/intr.c +++ b/sys/arch/hp300/hp300/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.42 2016/01/17 17:49:55 tsutsui Exp $ */ +/* $NetBSD: intr.c,v 1.43 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.42 2016/01/17 17:49:55 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.43 2019/11/10 21:16:27 chs Exp $"); #define _HP300_INTR_H_PRIVATE @@ -108,11 +108,7 @@ intr_establish(int (*func)(void *), void *arg, int ipl, int priority) if ((ipl < 0) || (ipl >= NISR)) panic("intr_establish: bad ipl %d", ipl); - newih = malloc(sizeof(struct hp300_intrhand), M_DEVBUF, M_NOWAIT); - if (newih == NULL) - panic("intr_establish: can't allocate space for handler"); - - /* Fill in the new entry. */ + newih = malloc(sizeof(struct hp300_intrhand), M_DEVBUF, M_WAITOK); newih->ih_fn = func; newih->ih_arg = arg; newih->ih_ipl = ipl; diff --git a/sys/arch/hpc/hpc/config_hook.c b/sys/arch/hpc/hpc/config_hook.c index 922e4c12cd55..7a9295533a71 100644 --- a/sys/arch/hpc/hpc/config_hook.c +++ b/sys/arch/hpc/hpc/config_hook.c @@ -1,4 +1,4 @@ -/* $NetBSD: config_hook.c,v 1.10 2013/11/27 17:24:43 christos Exp $ */ +/* $NetBSD: config_hook.c,v 1.11 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 1999-2001 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.10 2013/11/27 17:24:43 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.11 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -118,10 +118,7 @@ config_hook(int type, long id, enum config_hook_mode mode, } /* allocate new record */ - hr = malloc(sizeof(*hr), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (hr == NULL) - panic("config_hook: malloc failed"); - + hr = malloc(sizeof(*hr), M_DEVBUF, M_WAITOK); hr->hr_ctx = ctx; hr->hr_type = type; hr->hr_id = id; @@ -211,10 +208,7 @@ config_connect(int type, long id) } /* allocate new record */ - cr = malloc(sizeof(*hr), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (cr == NULL) - panic("config_connect: malloc failed"); - + cr = malloc(sizeof(*hr), M_DEVBUF, M_WAITOK); cr->hr_func = NULL; cr->hr_type = type; cr->hr_id = id; diff --git a/sys/arch/hpcarm/dev/wzero3_kbd.c b/sys/arch/hpcarm/dev/wzero3_kbd.c index b6d45f630e8a..57e168dce8ee 100644 --- a/sys/arch/hpcarm/dev/wzero3_kbd.c +++ b/sys/arch/hpcarm/dev/wzero3_kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wzero3_kbd.c,v 1.8 2012/10/27 17:17:52 chs Exp $ */ +/* $NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (C) 2008, 2009, 2010 NONAKA Kimihiro @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.8 2012/10/27 17:17:52 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -289,17 +289,9 @@ wzero3kbd_attach(device_t parent, device_t self, void *aux) } sc->sc_okeystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF, - M_NOWAIT | M_ZERO); + M_WAITOK | M_ZERO); sc->sc_keystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_okeystat == NULL || sc->sc_keystat == NULL) { - aprint_error_dev(self, "couldn't alloc memory.\n"); - if (sc->sc_okeystat) - free(sc->sc_okeystat, M_DEVBUF); - if (sc->sc_keystat) - free(sc->sc_keystat, M_DEVBUF); - return; - } + M_WAITOK | M_ZERO); sc->sc_if.hii_ctx = sc; sc->sc_if.hii_establish = wzero3kbd_input_establish; diff --git a/sys/arch/hpcarm/hpcarm/softintr.c b/sys/arch/hpcarm/hpcarm/softintr.c index fd44aa80644b..ce6a149b4034 100644 --- a/sys/arch/hpcarm/hpcarm/softintr.c +++ b/sys/arch/hpcarm/hpcarm/softintr.c @@ -1,4 +1,4 @@ -/* $NetBSD: softintr.c,v 1.15 2013/12/02 18:36:11 joerg Exp $ */ +/* $NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.15 2013/12/02 18:36:11 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $"); #include #include @@ -63,10 +63,7 @@ softintr_establish(int level, void (*fun)(void *), void *arg) { struct softintr_handler *sh; - sh = malloc(sizeof(*sh), M_DEVBUF, M_NOWAIT); - if (sh == NULL) - return NULL; - + sh = malloc(sizeof(*sh), M_DEVBUF, M_WAITOK); sh->sh_fun = fun; sh->sh_level = ipl_to_spl(level); sh->sh_arg = arg; diff --git a/sys/arch/hpcmips/dev/plum.c b/sys/arch/hpcmips/dev/plum.c index 66da40b8bff7..df683ac36de9 100644 --- a/sys/arch/hpcmips/dev/plum.c +++ b/sys/arch/hpcmips/dev/plum.c @@ -1,4 +1,4 @@ -/* $NetBSD: plum.c,v 1.16 2015/10/02 09:05:33 msaitoh Exp $ */ +/* $NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.16 2015/10/02 09:05:33 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -103,11 +103,8 @@ plum_attach(device_t parent, device_t self, void *aux) printf(": Plum2 #2\n"); break; } - if (!(sc->sc_pc = malloc(sizeof(struct plum_chipset_tag), - M_DEVBUF, M_NOWAIT))) { - panic("no memory"); - } - memset(sc->sc_pc, 0, sizeof(struct plum_chipset_tag)); + sc->sc_pc = malloc(sizeof(struct plum_chipset_tag), + M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_pc->pc_tc = ca->ca_tc; /* Attach Plum devices */ diff --git a/sys/arch/hpcmips/dev/plumiobus.c b/sys/arch/hpcmips/dev/plumiobus.c index 533fbe33ffa8..1de4f89bd38a 100644 --- a/sys/arch/hpcmips/dev/plumiobus.c +++ b/sys/arch/hpcmips/dev/plumiobus.c @@ -1,4 +1,4 @@ -/* $NetBSD: plumiobus.c,v 1.14 2012/10/27 17:17:53 chs Exp $ */ +/* $NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.14 2012/10/27 17:17:53 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $"); #define PLUMIOBUSDEBUG @@ -172,10 +172,7 @@ __plumiobus_subregion(bus_space_tag_t t, bus_addr_t ofs, bus_size_t size) { struct hpcmips_bus_space *hbs; - if (!(hbs = malloc(sizeof(struct hpcmips_bus_space), - M_DEVBUF, M_NOWAIT))) { - panic ("__plumiobus_subregion: no memory."); - } + hbs = malloc(sizeof(*hbs), M_DEVBUF, M_WAITOK); *hbs = *t; hbs->t_base += ofs; hbs->t_size = size; diff --git a/sys/arch/hpcmips/tx/tx39icu.c b/sys/arch/hpcmips/tx/tx39icu.c index 9ede55df3771..40c1336ae55a 100644 --- a/sys/arch/hpcmips/tx/tx39icu.c +++ b/sys/arch/hpcmips/tx/tx39icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: tx39icu.c,v 1.35 2015/07/11 10:32:45 kamil Exp $ */ +/* $NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.35 2015/07/11 10:32:45 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $"); #include "opt_vr41xx.h" #include "opt_tx39xx.h" @@ -507,11 +507,7 @@ tx39_irqhigh_establish(tx_chipset_tag_t tc, int set, int bit, int pri, /* * Add new entry to `pri' priority */ - if (!(he = malloc(sizeof(struct txintr_high_entry), - M_DEVBUF, M_NOWAIT))) { - panic ("tx39_irqhigh_establish: no memory."); - } - memset(he, 0, sizeof(struct txintr_high_entry)); + he = malloc(sizeof(struct txintr_high_entry), M_DEVBUF, M_WAITOK | M_ZERO); he->he_set = set; he->he_mask= (1 << bit); he->he_fun = ih_fun; @@ -631,17 +627,14 @@ tx39_poll_establish(tx_chipset_tag_t tc, int interval, int level, int s; void *ret; - s = splhigh(); - sc = tc->tc_intrt; - - if (!(p = malloc(sizeof(*p), M_DEVBUF, M_NOWAIT | M_ZERO))) { - panic ("tx39_poll_establish: no memory."); - } - + p = malloc(sizeof(*p), M_DEVBUF, M_WAITOK | M_ZERO); p->p_fun = ih_fun; p->p_arg = ih_arg; p->p_cnt = interval; + s = splhigh(); + sc = tc->tc_intrt; + if (!sc->sc_polling) { tx39clock_alarm_set(tc, 33); /* 33 msec */ diff --git a/sys/arch/hpcmips/vr/flash_vrip.c b/sys/arch/hpcmips/vr/flash_vrip.c index 432a560bd9d7..e95138354d63 100644 --- a/sys/arch/hpcmips/vr/flash_vrip.c +++ b/sys/arch/hpcmips/vr/flash_vrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: flash_vrip.c,v 1.11 2018/09/03 16:29:24 riastradh Exp $ */ +/* $NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.11 2018/09/03 16:29:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -262,11 +262,7 @@ flash_attach(device_t parent, device_t self, void *aux) sc->sc_block_size = block_size; } - if ((sc->sc_buf = malloc(sc->sc_block_size, M_DEVBUF, M_NOWAIT)) - == NULL) { - printf(": can't alloc buffer space\n"); - return; - } + sc->sc_buf = malloc(sc->sc_block_size, M_DEVBUF, M_WAITOK); sc->sc_write_buffer_size = 1 << (sc->sc_cfi_raw[CFI_MAX_WBUF_SIZE_REG0] @@ -375,8 +371,6 @@ int flashwrite(dev_t dev, struct uio *uio, int flag) { struct flash_softc *sc; - bus_space_tag_t iot; - bus_space_handle_t ioh; bus_size_t off; int stat; int error; @@ -390,9 +384,6 @@ flashwrite(dev_t dev, struct uio *uio, int flag) if (uio->uio_resid % sc->sc_block_size) return EINVAL; - iot = sc->sc_iot; - ioh = sc->sc_ioh; - for (off = uio->uio_offset; uio->uio_resid > 0; off += sc->sc_block_size) { diff --git a/sys/arch/hpcmips/vr/vr4181giu.c b/sys/arch/hpcmips/vr/vr4181giu.c index 1642b798bc12..8d7a944d60e5 100644 --- a/sys/arch/hpcmips/vr/vr4181giu.c +++ b/sys/arch/hpcmips/vr/vr4181giu.c @@ -1,4 +1,4 @@ -/* $NetBSD: vr4181giu.c,v 1.4 2012/10/27 17:17:55 chs Exp $ */ +/* $NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999-2001 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.4 2012/10/27 17:17:55 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -325,9 +325,7 @@ vr4181giu_intr_establish( s = splhigh(); - if ((ih = malloc(sizeof *ih, M_DEVBUF, M_NOWAIT)) == NULL) - panic("vr4181giu_intr_establish: memory exhausted."); - + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); ih->ih_port = port; ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; diff --git a/sys/arch/hpcmips/vr/vrc4172gpio.c b/sys/arch/hpcmips/vr/vrc4172gpio.c index 8e2ca781afb5..c29228e06639 100644 --- a/sys/arch/hpcmips/vr/vrc4172gpio.c +++ b/sys/arch/hpcmips/vr/vrc4172gpio.c @@ -1,4 +1,4 @@ -/* $NetBSD: vrc4172gpio.c,v 1.13 2012/10/27 17:17:55 chs Exp $ */ +/* $NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 2001 TAKEMRUA Shin. All rights reserved. * @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.13 2012/10/27 17:17:55 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -498,10 +498,7 @@ vrc4172gpio_intr_establish( mask2 = (1 << (port % 8)); intlv_reg = intlv_regs[port/8]; - ih = malloc(sizeof(struct vrc4172gpio_intr_entry), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - panic("%s: no memory", __func__); - + ih = malloc(sizeof(struct vrc4172gpio_intr_entry), M_DEVBUF, M_WAITOK); ih->ih_port = port; ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; diff --git a/sys/arch/hpcmips/vr/vrgiu.c b/sys/arch/hpcmips/vr/vrgiu.c index e8f74d01af7c..0a8ed87cc218 100644 --- a/sys/arch/hpcmips/vr/vrgiu.c +++ b/sys/arch/hpcmips/vr/vrgiu.c @@ -1,4 +1,4 @@ -/* $NetBSD: vrgiu.c,v 1.42 2012/10/27 17:17:56 chs Exp $ */ +/* $NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999-2001 * Shin Takemura and PocketBSD Project. All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.42 2012/10/27 17:17:56 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -534,9 +534,7 @@ vrgiu_intr_establish( s = splhigh(); - if (!(ih = malloc(sizeof(struct vrgiu_intr_entry), M_DEVBUF, M_NOWAIT))) - panic ("vrgiu_intr_establish: no memory."); - + ih = malloc(sizeof(struct vrgiu_intr_entry), M_DEVBUF, M_WAITOK); DPRINTF(DEBUG_INTR, ("%s: port %d ", device_xname(sc->sc_dev), port)); ih->ih_port = port; ih->ih_fun = ih_fun; diff --git a/sys/arch/hppa/dev/apic.c b/sys/arch/hppa/dev/apic.c index 06ab75d1f1b7..228c9430a019 100644 --- a/sys/arch/hppa/dev/apic.c +++ b/sys/arch/hppa/dev/apic.c @@ -1,4 +1,4 @@ -/* $NetBSD: apic.c,v 1.2 2014/03/31 20:51:20 christos Exp $ */ +/* $NetBSD: apic.c,v 1.3 2019/11/10 21:16:28 chs Exp $ */ /* $OpenBSD: apic.c,v 1.14 2011/05/01 21:59:39 kettenis Exp $ */ @@ -110,9 +110,7 @@ apic_attach(struct elroy_softc *sc) data & APIC_VERSION_MASK, sc->sc_nints); sc->sc_irq = malloc(sc->sc_nints * sizeof(int), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_irq == NULL) - panic("apic_attach: can't allocate irq table\n"); + M_WAITOK | M_ZERO); apic_get_int_tbl(sc); @@ -173,16 +171,8 @@ apic_intr_establish(void *v, pci_intr_handle_t ih, if (irq <= 0 || irq > 31) return NULL; - aiv = malloc(sizeof(struct apic_iv), M_DEVBUF, M_NOWAIT); - if (aiv == NULL) - return NULL; - - cnt = malloc(sizeof(struct evcnt), M_DEVBUF, M_NOWAIT); - if (cnt == NULL) { - free(aiv, M_DEVBUF); - return NULL; - } - + aiv = malloc(sizeof(struct apic_iv), M_DEVBUF, M_WAITOK); + cnt = malloc(sizeof(struct evcnt), M_DEVBUF, M_WAITOK); aiv->sc = sc; aiv->ih = ih; aiv->handler = handler; @@ -277,9 +267,7 @@ apic_get_int_tbl(struct elroy_softc *sc) size = nentries * sizeof(struct pdc_pat_pci_rt); sc->sc_int_tbl_sz = nentries; - sc->sc_int_tbl = malloc(size, M_DEVBUF, M_NOWAIT); - if (sc->sc_int_tbl == NULL) - return; + sc->sc_int_tbl = malloc(size, M_DEVBUF, M_WAITOK); pdcproc_pci_gettable(nentries, size, sc->sc_int_tbl); } diff --git a/sys/arch/i386/i386/mtrr_k6.c b/sys/arch/i386/i386/mtrr_k6.c index e3ccd31e61c3..46c3463133f4 100644 --- a/sys/arch/i386/i386/mtrr_k6.c +++ b/sys/arch/i386/i386/mtrr_k6.c @@ -1,4 +1,4 @@ -/* $NetBSD: mtrr_k6.c,v 1.13 2008/04/04 22:07:22 cegger Exp $ */ +/* $NetBSD: mtrr_k6.c,v 1.14 2019/11/10 21:16:28 chs Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.13 2008/04/04 22:07:22 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mtrr_k6.c,v 1.14 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -149,9 +149,7 @@ k6_mtrr_init_first(void) #endif mtrr_var = (struct mtrr *) - malloc(MTRR_K6_NVAR * sizeof(struct mtrr), M_TEMP, M_NOWAIT); - if (mtrr_var == NULL) - panic("can't allocate variable MTRR array"); + malloc(MTRR_K6_NVAR * sizeof(struct mtrr), M_TEMP, M_WAITOK); mtrr_funcs = &k6_mtrr_funcs; k6_raw2soft(); diff --git a/sys/arch/i386/isa/ahc_isa.c b/sys/arch/i386/isa/ahc_isa.c index 79cb6b261126..bae6a1128dee 100644 --- a/sys/arch/i386/isa/ahc_isa.c +++ b/sys/arch/i386/isa/ahc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahc_isa.c,v 1.41 2016/07/11 11:31:49 msaitoh Exp $ */ +/* $NetBSD: ahc_isa.c,v 1.42 2019/11/10 21:16:28 chs Exp $ */ /* * Product specific probe and attach routines for: @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.41 2016/07/11 11:31:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.42 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -336,11 +336,7 @@ ahc_isa_probe(device_t parent, cfdata_t match, void *aux) /* * Don't have one, so make one. */ - as = (struct ahc_isa_slot *) - malloc(sizeof(struct ahc_isa_slot), M_DEVBUF, M_NOWAIT); - if (as == NULL) - panic("ahc_isa_probe: can't allocate slot marker"); - + as = malloc(sizeof(struct ahc_isa_slot), M_DEVBUF, M_WAITOK); as->bus = device_unit(parent); as->slot = AHC_ISA_MIN_SLOT; LIST_INSERT_HEAD(&ahc_isa_all_slots, as, link); diff --git a/sys/arch/i386/pci/pci_intr_fixup.c b/sys/arch/i386/pci/pci_intr_fixup.c index d4d01fa439cb..942f023e24d1 100644 --- a/sys/arch/i386/pci/pci_intr_fixup.c +++ b/sys/arch/i386/pci/pci_intr_fixup.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_intr_fixup.c,v 1.50 2014/09/09 06:38:33 apb Exp $ */ +/* $NetBSD: pci_intr_fixup.c,v 1.51 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_intr_fixup.c,v 1.50 2014/09/09 06:38:33 apb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_intr_fixup.c,v 1.51 2019/11/10 21:16:28 chs Exp $"); #include "opt_pcibios.h" #include "opt_pcifixup.h" @@ -287,12 +287,7 @@ pciintr_link_alloc(struct pcibios_intr_routing *pir, int pin) } } - l = malloc(sizeof(*l), M_DEVBUF, M_NOWAIT); - if (l == NULL) - panic("pciintr_link_alloc"); - - memset(l, 0, sizeof(*l)); - + l = malloc(sizeof(*l), M_DEVBUF, M_WAITOK | M_ZERO); l->link = link; l->bitmap = pir->linkmap[pin].bitmap; if (pciintr_icu_tag != NULL) { /* compatible PCI ICU found */ diff --git a/sys/arch/i386/pci/pcibios.c b/sys/arch/i386/pci/pcibios.c index 2a550bb1ebb9..02988f8c9edb 100644 --- a/sys/arch/i386/pci/pcibios.c +++ b/sys/arch/i386/pci/pcibios.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcibios.c,v 1.39 2010/07/26 22:33:23 jym Exp $ */ +/* $NetBSD: pcibios.c,v 1.40 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcibios.c,v 1.39 2010/07/26 22:33:23 jym Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcibios.c,v 1.40 2019/11/10 21:16:28 chs Exp $"); #include "opt_pcibios.h" #include "opt_pcifixup.h" @@ -275,11 +275,7 @@ pcibios_pir_init(void) */ memcpy(&pcibios_pir_header, p, 32); pcibios_pir_table = malloc(tablesize - 32, M_DEVBUF, - M_NOWAIT); - if (pcibios_pir_table == NULL) { - aprint_error("pcibios_pir_init: no memory for $PIR\n"); - return; - } + M_WAITOK); memcpy(pcibios_pir_table, p + 32, tablesize - 32); pcibios_pir_table_nentries = (tablesize - 32) / 16; @@ -288,13 +284,11 @@ pcibios_pir_init(void) PIR_DEVFUNC_DEVICE(pcibios_pir_header.router_devfunc), PIR_DEVFUNC_FUNCTION(pcibios_pir_header.router_devfunc)); if (pcibios_pir_header.compat_router != 0) { - devinfo = malloc(256, M_DEVBUF, M_NOWAIT); - if (devinfo) { - pci_devinfo(pcibios_pir_header.compat_router, - 0, 0, devinfo, 256); - aprint_verbose(" (%s compatible)", devinfo); - free(devinfo, M_DEVBUF); - } + devinfo = malloc(256, M_DEVBUF, M_WAITOK); + pci_devinfo(pcibios_pir_header.compat_router, + 0, 0, devinfo, 256); + aprint_verbose(" (%s compatible)", devinfo); + free(devinfo, M_DEVBUF); } aprint_verbose("\n"); pcibios_print_exclirq(); @@ -321,11 +315,7 @@ pcibios_pir_init(void) */ pcibios_pir_table_nentries = 32; pcibios_pir_table = malloc(pcibios_pir_table_nentries * - sizeof(*pcibios_pir_table), M_DEVBUF, M_NOWAIT); - if (pcibios_pir_table == NULL) { - aprint_error("pcibios_pir_init: no memory for $PIR\n"); - return; - } + sizeof(*pcibios_pir_table), M_DEVBUF, M_WAITOK); if (pcibios_get_intr_routing(pcibios_pir_table, &pcibios_pir_table_nentries, &pcibios_pir_header.exclusive_irq) != PCIBIOS_SUCCESS) { diff --git a/sys/arch/i386/pnpbios/pnpbios.c b/sys/arch/i386/pnpbios/pnpbios.c index 55033ed99c10..3a78d6eb7c33 100644 --- a/sys/arch/i386/pnpbios/pnpbios.c +++ b/sys/arch/i386/pnpbios/pnpbios.c @@ -1,4 +1,4 @@ -/* $NetBSD: pnpbios.c,v 1.73 2017/02/26 10:49:25 maya Exp $ */ +/* $NetBSD: pnpbios.c,v 1.74 2019/11/10 21:16:28 chs Exp $ */ /* * Copyright (c) 2000 Jason R. Thorpe. All rights reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.73 2017/02/26 10:49:25 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.74 2019/11/10 21:16:28 chs Exp $"); #include #include @@ -330,7 +330,7 @@ pnpbios_attach(device_t parent, device_t self, void *aux) aprint_error(": no vm for mapping\n"); return; } - pnpbios_scratchbuf = malloc(PNPBIOS_BUFSIZE, M_DEVBUF, M_NOWAIT); + pnpbios_scratchbuf = malloc(PNPBIOS_BUFSIZE, M_DEVBUF, M_WAITOK); setsegment(&gdtstore[GPNPBIOSCODE_SEL].sd, codeva, 0xffff, SDT_MEMERA, SEL_KPL, 0, 0); @@ -393,11 +393,7 @@ pnpbios_enumerate(struct pnpbios_softc *sc) return; } - buf = malloc(size, M_DEVBUF, M_NOWAIT); - if (buf == NULL) { - aprint_error_dev(sc->sc_dev, "unable to allocate node buffer\n"); - return; - } + buf = malloc(size, M_DEVBUF, M_WAITOK); /* * Loop through the list of indices getting data and match/attaching @@ -965,7 +961,7 @@ pnp_scan(const uint8_t **bufp, size_t maxlen, const struct pnpansiidentres *res = start; if (in_depends) aprint_normal("ID in dep?\n"); - idstr = malloc(len + 1, M_DEVBUF, M_NOWAIT); + idstr = malloc(len + 1, M_DEVBUF, M_WAITOK); for (i = 0; i < len; i++) idstr[i] = res->r_id[i]; idstr[len] = '\0'; @@ -1086,7 +1082,7 @@ pnp_scan(const uint8_t **bufp, size_t maxlen, last = r; do { new = malloc(sizeof(*new), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); rv = pnp_scan(&p, maxlen - (p - *bufp), new, 1); @@ -1133,7 +1129,7 @@ pnp_newirq(struct pnpresources *r, const void *vres, size_t len) DPRINTF(("\ttag irq zeroed\n")); return (0); } - irq = malloc(sizeof(struct pnp_irq), M_DEVBUF, M_NOWAIT); + irq = malloc(sizeof(struct pnp_irq), M_DEVBUF, M_WAITOK); irq->mask = res->r_mask; if (len > 2) irq->flags = res->r_info; @@ -1158,7 +1154,7 @@ pnp_newdma(struct pnpresources *r, const void *vres, size_t len) DPRINTF(("\ttag DMA zeroed\n")); return (0); } - dma = malloc(sizeof(struct pnp_dma), M_DEVBUF, M_NOWAIT); + dma = malloc(sizeof(struct pnp_dma), M_DEVBUF, M_WAITOK); dma->mask = res->r_mask; dma->flags = res->r_flags; SIMPLEQ_INSERT_TAIL(&r->dma, dma, next); @@ -1180,7 +1176,7 @@ pnp_newioport(struct pnpresources *r, const void *vres, size_t len) DPRINTF(("\ttag io zeroed\n")); return (0); } - io = malloc(sizeof(struct pnp_io), M_DEVBUF, M_NOWAIT); + io = malloc(sizeof(struct pnp_io), M_DEVBUF, M_WAITOK); io->flags = res->r_flags; io->minbase = res->r_minbase; io->maxbase = res->r_maxbase; @@ -1208,7 +1204,7 @@ pnp_newfixedioport(struct pnpresources *r, const void *vres, DPRINTF(("\ttag fixedio zeroed\n")); return (0); } - io = malloc(sizeof(struct pnp_io), M_DEVBUF, M_NOWAIT); + io = malloc(sizeof(struct pnp_io), M_DEVBUF, M_WAITOK); io->flags = 1; /* 10 bit decoding */ io->minbase = io->maxbase = res->r_base; io->align = 1; @@ -1229,7 +1225,7 @@ pnp_compatid(struct pnpresources *r, const void *vres, size_t len) struct pnp_compatid *id; res = vres; - id = malloc(sizeof(*id), M_DEVBUF, M_NOWAIT); + id = malloc(sizeof(*id), M_DEVBUF, M_WAITOK); pnpbios_id_to_string(res->r_id, id->idstr); id->next = r->compatids; r->compatids = id; diff --git a/sys/arch/ia64/ia64/interrupt.c b/sys/arch/ia64/ia64/interrupt.c index 4feca2afbcbc..11e3987af28c 100644 --- a/sys/arch/ia64/ia64/interrupt.c +++ b/sys/arch/ia64/ia64/interrupt.c @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.9 2018/11/16 19:46:52 jmcneill Exp $ */ +/* $NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $ */ /*- * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -33,7 +33,7 @@ */ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.9 2018/11/16 19:46:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.10 2019/11/10 21:16:28 chs Exp $"); #include "opt_ddb.h" @@ -293,9 +293,7 @@ intr_establish(int irq, int type, int level, int (*func)(void *), void *arg) i = ia64_intrs[vector]; if (i == NULL) { - i = malloc(sizeof(struct ia64_intr), M_DEVBUF, M_NOWAIT); - if (i == NULL) - return NULL; + i = malloc(sizeof(struct ia64_intr), M_DEVBUF, M_WAITOK); i->irq = irq; i->sapic = sa; i->type = type; @@ -311,9 +309,7 @@ intr_establish(int irq, int type, int level, int (*func)(void *), void *arg) if (i->type != type) return NULL; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return NULL; + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_level = level; diff --git a/sys/arch/ibmnws/ibmnws/mainbus.c b/sys/arch/ibmnws/ibmnws/mainbus.c index e832053cc248..d6543a55a754 100644 --- a/sys/arch/ibmnws/ibmnws/mainbus.c +++ b/sys/arch/ibmnws/ibmnws/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.11 2012/01/27 18:52:57 para Exp $ */ +/* $NetBSD: mainbus.c,v 1.12 2019/11/10 21:16:29 chs Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -119,8 +119,7 @@ mainbus_attach(device_t parent, device_t self, void *aux) */ #if NPCI > 0 genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_NOWAIT); - KASSERT(genppc_pct != NULL); + M_WAITOK); ibmnws_pci_get_chipset_tag_indirect (genppc_pct); #ifdef PCI_NETBSD_CONFIGURE diff --git a/sys/arch/landisk/landisk/intr.c b/sys/arch/landisk/landisk/intr.c index 30eddb57cedc..e1a58ff2625c 100644 --- a/sys/arch/landisk/landisk/intr.c +++ b/sys/arch/landisk/landisk/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.7 2014/10/13 22:24:43 uwe Exp $ */ +/* $NetBSD: intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (C) 2005 NONAKA Kimihiro @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.7 2014/10/13 22:24:43 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $"); #include #include @@ -143,9 +143,7 @@ extintr_establish(int irq, int level, int (*ih_fun)(void *), void *ih_arg) KDASSERT(irq >= 5 && irq <= 12); - ih = malloc(sizeof(*ih), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("intr_establish: can't malloc handler info"); + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); s = _cpu_intr_suspend(); diff --git a/sys/arch/luna68k/luna68k/isr.c b/sys/arch/luna68k/luna68k/isr.c index 10080ed2bdb4..cfb7b23d253f 100644 --- a/sys/arch/luna68k/luna68k/isr.c +++ b/sys/arch/luna68k/luna68k/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.22 2014/03/22 16:52:07 tsutsui Exp $ */ +/* $NetBSD: isr.c,v 1.23 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2014/03/22 16:52:07 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23 2019/11/10 21:16:29 chs Exp $"); /* * Link and dispatch interrupts. @@ -82,12 +82,7 @@ isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority) if ((ipl < 0) || (ipl >= NISRAUTOVEC)) panic("isrlink_autovec: bad ipl %d", ipl); - newisr = (struct isr_autovec *)malloc(sizeof(struct isr_autovec), - M_DEVBUF, M_NOWAIT); - if (newisr == NULL) - panic("isrlink_autovec: can't allocate space for isr"); - - /* Fill in the new entry. */ + newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK); newisr->isr_func = func; newisr->isr_arg = arg; newisr->isr_ipl = ipl; diff --git a/sys/arch/mac68k/dev/grf_compat.c b/sys/arch/mac68k/dev/grf_compat.c index 47cc71ecce1c..c5646469d45b 100644 --- a/sys/arch/mac68k/dev/grf_compat.c +++ b/sys/arch/mac68k/dev/grf_compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_compat.c,v 1.28 2015/08/20 14:40:17 christos Exp $ */ +/* $NetBSD: grf_compat.c,v 1.29 2019/11/10 21:16:29 chs Exp $ */ /* * Copyright (C) 1999 Scott Reynolds @@ -34,7 +34,7 @@ #include "opt_grf_compat.h" #include -__KERNEL_RCSID(0, "$NetBSD: grf_compat.c,v 1.28 2015/08/20 14:40:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_compat.c,v 1.29 2019/11/10 21:16:29 chs Exp $"); #include #include @@ -118,17 +118,11 @@ grf_init(int n) if (grf_softc == NULL) sc = (struct grf_softc *) malloc(numgrf * sizeof(*sc), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); else sc = (struct grf_softc *) realloc(grf_softc, numgrf * sizeof(*sc), - M_DEVBUF, M_NOWAIT); - if (sc == NULL) { - printf("WARNING: no memory for grf emulation\n"); - if (grf_softc != NULL) - free(grf_softc, M_DEVBUF); - return; - } + M_DEVBUF, M_WAITOK); grf_softc = sc; /* Initialize per-softc structures. */ diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index d46669277389..1549441d0b47 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bm.c,v 1.60 2019/05/28 07:41:47 msaitoh Exp $ */ +/* $NetBSD: if_bm.c,v 1.61 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.60 2019/05/28 07:41:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.61 2019/11/10 21:16:29 chs Exp $"); #include "opt_inet.h" @@ -217,13 +217,8 @@ bmac_attach(device_t parent, device_t self, void *aux) sc->sc_txcmd = dbdma_alloc(BMAC_TXBUFS * sizeof(dbdma_command_t), NULL); sc->sc_rxcmd = dbdma_alloc((BMAC_RXBUFS + 1) * sizeof(dbdma_command_t), NULL); - sc->sc_txbuf = malloc(BMAC_BUFLEN * BMAC_TXBUFS, M_DEVBUF, M_NOWAIT); - sc->sc_rxbuf = malloc(BMAC_BUFLEN * BMAC_RXBUFS, M_DEVBUF, M_NOWAIT); - if (sc->sc_txbuf == NULL || sc->sc_rxbuf == NULL || - sc->sc_txcmd == NULL || sc->sc_rxcmd == NULL) { - aprint_error("cannot allocate memory\n"); - return; - } + sc->sc_txbuf = malloc(BMAC_BUFLEN * BMAC_TXBUFS, M_DEVBUF, M_WAITOK); + sc->sc_rxbuf = malloc(BMAC_BUFLEN * BMAC_RXBUFS, M_DEVBUF, M_WAITOK); aprint_normal(" irq %d,%d: address %s\n", ca->ca_intr[0], ca->ca_intr[2], diff --git a/sys/arch/macppc/dev/if_gm.c b/sys/arch/macppc/dev/if_gm.c index a9659b43e748..14bd91bd1462 100644 --- a/sys/arch/macppc/dev/if_gm.c +++ b/sys/arch/macppc/dev/if_gm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gm.c,v 1.55 2019/05/28 07:41:47 msaitoh Exp $ */ +/* $NetBSD: if_gm.c,v 1.56 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.55 2019/05/28 07:41:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.56 2019/11/10 21:16:29 chs Exp $"); #include "opt_inet.h" @@ -42,8 +42,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.55 2019/05/28 07:41:47 msaitoh Exp $"); #include -#include - #include #include #include @@ -65,6 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.55 2019/05/28 07:41:47 msaitoh Exp $"); #include #include #include +#include #define NTXBUF 4 #define NRXBUF 32 @@ -183,11 +182,7 @@ gmac_attach(device_t parent, device_t self, void *aux) } /* Setup packet buffers and DMA descriptors. */ - p = malloc((NRXBUF + NTXBUF) * 2048 + 3 * 0x800, M_DEVBUF, M_NOWAIT); - if (p == NULL) { - printf(": cannot malloc buffers\n"); - return; - } + p = malloc((NRXBUF + NTXBUF) * 2048 + 3 * 0x800, M_DEVBUF, M_WAITOK); p = (void *)roundup((vaddr_t)p, 0x800); memset(p, 0, 2048 * (NRXBUF + NTXBUF) + 2 * 0x800); @@ -430,9 +425,9 @@ gmac_get(struct gmac_softc *sc, void *pkt, int totlen) } len = MCLBYTES; } - m->m_len = len = min(totlen, len); + m->m_len = len = imin(totlen, len); memcpy(mtod(m, void *), pkt, len); - pkt += len; + pkt = (char *)pkt + len; totlen -= len; *mp = m; mp = &m->m_next; @@ -509,7 +504,7 @@ gmac_put(struct gmac_softc *sc, void *buff, struct mbuf *m) if (len == 0) continue; memcpy(buff, mtod(m, void *), len); - buff += len; + buff = (char *)buff + len; tlen += len; } if (tlen > 2048) @@ -590,7 +585,7 @@ gmac_init_mac(struct gmac_softc *sc) /* init-mii */ gmac_write_reg(sc, GMAC_DATAPATHMODE, 4); - gmac_mii_writereg(&sc->sc_dev, 0, 0, 0x1000); + gmac_mii_writereg(sc->sc_dev, 0, 0, 0x1000); gmac_write_reg(sc, GMAC_TXDMACONFIG, 0xffc00); gmac_write_reg(sc, GMAC_RXDMACONFIG, 0); @@ -749,7 +744,6 @@ gmac_ioctl(struct ifnet *ifp, unsigned long cmd, void *data) { struct gmac_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; - struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c index 7a90fef48824..e6b1ef1a945f 100644 --- a/sys/arch/macppc/dev/smu.c +++ b/sys/arch/macppc/dev/smu.c @@ -240,7 +240,7 @@ smu_setup_doorbell(struct smu_softc *sc) int node, parent, reg[4], gpio_base, irq; mutex_init(&sc->sc_cmd_lock, MUTEX_DEFAULT, IPL_NONE); - sc->sc_cmd = malloc(4096, M_DEVBUF, M_NOWAIT); + sc->sc_cmd = malloc(4096, M_DEVBUF, M_WAITOK); sc->sc_cmd_paddr = vtophys((vaddr_t) sc->sc_cmd); DPRINTF("%s: cmd vaddr 0x%x paddr 0x%x\n", diff --git a/sys/arch/macppc/macppc/memory.c b/sys/arch/macppc/macppc/memory.c index 5e041da6cb42..efaf44baa0b9 100644 --- a/sys/arch/macppc/macppc/memory.c +++ b/sys/arch/macppc/macppc/memory.c @@ -1,4 +1,4 @@ -/* $NetBSD: memory.c,v 1.5 2011/10/26 13:54:18 macallan Exp $ */ +/* $NetBSD: memory.c,v 1.6 2019/11/10 21:16:29 chs Exp $ */ /* $OpenBSD: mem.c,v 1.15 2007/10/14 17:29:04 kettenis Exp $ */ /*- @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: memory.c,v 1.5 2011/10/26 13:54:18 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: memory.c,v 1.6 2019/11/10 21:16:29 chs Exp $"); #include #include @@ -101,11 +101,7 @@ memory_attach(device_t parent, device_t self, void *aux) sc->sc_dev = self; sc->sc_len = OF_getproplen(ca->ca_node, "dimm-info"); if (sc->sc_len > 0) { - sc->sc_buf = malloc(sc->sc_len, M_DEVBUF, M_NOWAIT); - if (sc->sc_buf == NULL) { - printf(": can't allocate memory\n"); - return; - } + sc->sc_buf = malloc(sc->sc_len, M_DEVBUF, M_WAITOK); printf(": len=%d", sc->sc_len); } @@ -172,5 +168,3 @@ memory_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, memcpy(buf, &sc->sc_buf[off], len); return (0); } - - diff --git a/sys/arch/mips/adm5120/adm5120_intr.c b/sys/arch/mips/adm5120/adm5120_intr.c index 97f1adf003db..16ac04cd3245 100644 --- a/sys/arch/mips/adm5120/adm5120_intr.c +++ b/sys/arch/mips/adm5120/adm5120_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: adm5120_intr.c,v 1.7 2016/08/26 15:45:48 skrll Exp $ */ +/* $NetBSD: adm5120_intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adm5120_intr.c,v 1.7 2016/08/26 15:45:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adm5120_intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $"); #include "opt_ddb.h" #define __INTR_PRIVATE @@ -191,10 +191,7 @@ adm5120_intr_establish(int irq, int priority, int (*func)(void *), void *arg) if (irq < 0 || irq >= NIRQS) panic("adm5120_intr_establish: bogus IRQ %d", irq); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/mips/alchemy/au_himem_space.c b/sys/arch/mips/alchemy/au_himem_space.c index 50f628ab0a4c..e23e278e383d 100644 --- a/sys/arch/mips/alchemy/au_himem_space.c +++ b/sys/arch/mips/alchemy/au_himem_space.c @@ -1,4 +1,4 @@ -/* $NetBSD: au_himem_space.c,v 1.14 2012/01/27 18:52:57 para Exp $ */ +/* $NetBSD: au_himem_space.c,v 1.15 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.14 2012/01/27 18:52:57 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.15 2019/11/10 21:16:29 chs Exp $"); /* * This provides mappings for the upper I/O regions used on some @@ -693,8 +693,7 @@ au_himem_space_init(bus_space_tag_t bst, const char *name, au_himem_cookie_t *c; c = malloc(sizeof (struct au_himem_cookie), M_DEVBUF, - M_NOWAIT | M_ZERO); - + M_WAITOK | M_ZERO); c->c_name = name; c->c_start = start; c->c_end = end; diff --git a/sys/arch/mips/alchemy/au_icu.c b/sys/arch/mips/alchemy/au_icu.c index dd59e81e00fb..d659a5a54600 100644 --- a/sys/arch/mips/alchemy/au_icu.c +++ b/sys/arch/mips/alchemy/au_icu.c @@ -1,4 +1,4 @@ -/* $NetBSD: au_icu.c,v 1.29 2012/01/14 16:09:19 kiyohara Exp $ */ +/* $NetBSD: au_icu.c,v 1.30 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: au_icu.c,v 1.29 2012/01/14 16:09:19 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: au_icu.c,v 1.30 2019/11/10 21:16:29 chs Exp $"); #include "opt_ddb.h" #define __INTR_PRIVATE @@ -199,10 +199,7 @@ au_intr_establish(int irq, int req, int level, int type, if (req > 1) panic("au_intr_establish: bogus request %d", req); - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; diff --git a/sys/arch/mips/alchemy/au_wired_space.c b/sys/arch/mips/alchemy/au_wired_space.c index ea6cbfa58afa..adbe6c652a97 100644 --- a/sys/arch/mips/alchemy/au_wired_space.c +++ b/sys/arch/mips/alchemy/au_wired_space.c @@ -1,4 +1,4 @@ -/* $NetBSD: au_wired_space.c,v 1.9 2012/01/27 18:52:58 para Exp $ */ +/* $NetBSD: au_wired_space.c,v 1.10 2019/11/10 21:16:29 chs Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: au_wired_space.c,v 1.9 2012/01/27 18:52:58 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: au_wired_space.c,v 1.10 2019/11/10 21:16:29 chs Exp $"); /* * This provides mappings for the upper I/O regions used on some @@ -633,8 +633,7 @@ au_wired_space_init(bus_space_tag_t bst, const char *name, au_wired_cookie_t *c; c = malloc(sizeof (struct au_wired_cookie), M_DEVBUF, - M_NOWAIT | M_ZERO); - + M_WAITOK | M_ZERO); c->c_pbase = paddr; c->c_name = name; c->c_start = start; diff --git a/sys/arch/mips/atheros/ar_intr.c b/sys/arch/mips/atheros/ar_intr.c index c9134815c931..2ae1f902a630 100644 --- a/sys/arch/mips/atheros/ar_intr.c +++ b/sys/arch/mips/atheros/ar_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ar_intr.c,v 1.5 2015/06/29 16:36:17 maxv Exp $ */ +/* $NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $ */ /* * Copyright (c) 2006 Urbana-Champaign Independent Media Center. * Copyright (c) 2006 Garrett D'Amore. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.5 2015/06/29 16:36:17 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $"); #define __INTR_PRIVATE @@ -110,9 +110,7 @@ genath_cpu_intr_establish(int intr, int (*func)(void *), void *arg) { struct atheros_intrhand *ih; - if ((ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT)) == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = intr; @@ -152,9 +150,7 @@ genath_misc_intr_establish(int irq, int (*func)(void *), void *arg) int s; - if ((ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT)) == NULL) - return NULL; - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = irq; @@ -296,4 +292,3 @@ const struct atheros_intrsw atheros_intrsw = { .aisw_misc_disestablish = genath_misc_intr_disestablish, .aisw_iointr = genath_iointr, }; - diff --git a/sys/arch/mips/atheros/dev/athflash.c b/sys/arch/mips/atheros/dev/athflash.c index 3cb40b2f4f46..7751cfecb0a4 100644 --- a/sys/arch/mips/atheros/dev/athflash.c +++ b/sys/arch/mips/atheros/dev/athflash.c @@ -1,4 +1,4 @@ -/* $NetBSD: athflash.c,v 1.10 2018/09/03 16:29:25 riastradh Exp $ */ +/* $NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.10 2018/09/03 16:29:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -251,11 +251,7 @@ flash_attach(device_t parent, device_t self, void *aux) sc->sc_size = flash_ids[i].flash_size; sc->sc_sector_size = flash_ids[i].sector_size; - if ((sc->sc_buf = malloc(sc->sc_sector_size, M_DEVBUF, M_NOWAIT)) - == NULL) { - printf(": can't alloc buffer space\n"); - return; - } + sc->sc_buf = malloc(sc->sc_sector_size, M_DEVBUF, M_WAITOK); printf("\n"); } diff --git a/sys/arch/mips/cavium/dev/octeon_gmx.c b/sys/arch/mips/cavium/dev/octeon_gmx.c index ad0d113bf867..46f97bd498b6 100644 --- a/sys/arch/mips/cavium/dev/octeon_gmx.c +++ b/sys/arch/mips/cavium/dev/octeon_gmx.c @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.5 2019/05/28 14:20:09 msaitoh Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.6 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.5 2019/05/28 14:20:09 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.6 2019/11/10 21:16:30 chs Exp $"); #include "opt_octeon.h" @@ -207,7 +207,7 @@ octeon_gmx_attach(device_t parent, device_t self, void *aux) octeon_gmx_init(sc); sc->sc_ports = malloc(sizeof(*sc->sc_ports) * sc->sc_nports, M_DEVBUF, - M_NOWAIT | M_ZERO); + M_WAITOK | M_ZERO); for (i = 0; i < sc->sc_nports; i++) { port_sc = &sc->sc_ports[i]; diff --git a/sys/arch/mips/cavium/dev/octeon_pow.c b/sys/arch/mips/cavium/dev/octeon_pow.c index 138176ec1207..18115fe0f3c2 100644 --- a/sys/arch/mips/cavium/dev/octeon_pow.c +++ b/sys/arch/mips/cavium/dev/octeon_pow.c @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_pow.c,v 1.4 2019/05/28 08:59:34 msaitoh Exp $ */ +/* $NetBSD: octeon_pow.c,v 1.5 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_pow.c,v 1.4 2019/05/28 08:59:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_pow.c,v 1.5 2019/11/10 21:16:30 chs Exp $"); #include "opt_octeon.h" /* OCTEON_ETH_DEBUG */ @@ -323,9 +323,7 @@ octeon_pow_intr_establish(int group, int level, KASSERT(group >= 0); KASSERT(group < 16); - pow_ih = malloc(sizeof(*pow_ih), M_DEVBUF, M_NOWAIT); - KASSERT(pow_ih != NULL); - + pow_ih = malloc(sizeof(*pow_ih), M_DEVBUF, M_WAITOK); pow_ih->pi_ih = octeon_intr_establish( ffs64(CIU_INTX_SUM0_WORKQ_0) - 1 + group, level, @@ -357,7 +355,7 @@ octeon_pow_intr_debug_init(struct octeon_pow_intr_handle *pow_ih, int group) name = malloc(_NAMELEN + _DESCRLEN * __arraycount(pow_ih->pi_ev_per) + _DESCRLEN * __arraycount(pow_ih->pi_ev_ival), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); descr = name + _NAMELEN; snprintf(name, _NAMELEN, "pow%d", group); for (i = 0; i < (int)__arraycount(pow_ih->pi_ev_per); i++) { diff --git a/sys/arch/mips/ralink/ralink_intr.c b/sys/arch/mips/ralink/ralink_intr.c index 76a76e5dc818..0c212bc3c9e0 100644 --- a/sys/arch/mips/ralink/ralink_intr.c +++ b/sys/arch/mips/ralink/ralink_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ralink_intr.c,v 1.5 2016/10/05 15:54:58 ryo Exp $ */ +/* $NetBSD: ralink_intr.c,v 1.6 2019/11/10 21:16:30 chs Exp $ */ /*- * Copyright (c) 2011 CradlePoint Technology, Inc. * All rights reserved. @@ -29,7 +29,7 @@ #define __INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: ralink_intr.c,v 1.5 2016/10/05 15:54:58 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ralink_intr.c,v 1.6 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -267,11 +267,7 @@ ra_intr_establish(int intr, int (*func)(void *), void *arg, int priority) { struct evbmips_intrhand *ih; - if ((ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT)) == NULL) { - KASSERTMSG(0, "%s: cannot malloc intrhand", __func__); - return NULL; - } - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_irq = intr; diff --git a/sys/arch/mips/rmi/rmixl_pcie.c b/sys/arch/mips/rmi/rmixl_pcie.c index 1e9017afcd52..fd3bd33147c4 100644 --- a/sys/arch/mips/rmi/rmixl_pcie.c +++ b/sys/arch/mips/rmi/rmixl_pcie.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_pcie.c,v 1.12 2015/10/02 05:22:51 msaitoh Exp $ */ +/* $NetBSD: rmixl_pcie.c,v 1.13 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.12 2015/10/02 05:22:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.13 2019/11/10 21:16:30 chs Exp $"); #include "opt_pci.h" #include "pci.h" @@ -566,9 +566,7 @@ rmixl_pcie_intcfg(struct rmixl_pcie_softc *sc) * allocate per-cpu, per-pin interrupt event counters */ size = ncpu * PCI_INTERRUPT_PIN_MAX * sizeof(rmixl_pcie_evcnt_t); - ev = malloc(size, M_DEVBUF, M_NOWAIT); - if (ev == NULL) - panic("%s: cannot malloc evcnts\n", __func__); + ev = malloc(size, M_DEVBUF, M_WAITOK); sc->sc_evcnts[link] = ev; for (int pin=PCI_INTERRUPT_PIN_A; pin <= PCI_INTERRUPT_PIN_MAX; pin++) { for (int cpu=0; cpu < ncpu; cpu++) { @@ -1344,14 +1342,7 @@ rmixl_pcie_lip_add_1(rmixl_pcie_softc_t *sc, u_int link, int irq, int ipl) * allocate and initialize link intr struct * with one or more dispatch handles */ - lip_new = malloc(size, M_DEVBUF, M_NOWAIT); - if (lip_new == NULL) { -#ifdef DIAGNOSTIC - printf("%s: cannot malloc\n", __func__); -#endif - return NULL; - } - + lip_new = malloc(size, M_DEVBUF, M_WAITOK); if (lip_old == NULL) { /* initialize the link interrupt struct */ lip_new->sc = sc; diff --git a/sys/arch/mips/rmi/rmixl_pcix.c b/sys/arch/mips/rmi/rmixl_pcix.c index e735d717305d..d6d6726d5a79 100644 --- a/sys/arch/mips/rmi/rmixl_pcix.c +++ b/sys/arch/mips/rmi/rmixl_pcix.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_pcix.c,v 1.13 2015/10/02 05:22:51 msaitoh Exp $ */ +/* $NetBSD: rmixl_pcix.c,v 1.14 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.13 2015/10/02 05:22:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.14 2019/11/10 21:16:30 chs Exp $"); #include "opt_pci.h" #include "pci.h" @@ -506,9 +506,7 @@ rmixl_pcix_intcfg(rmixl_pcix_softc_t *sc) * allocate per-cpu, per-pin interrupt event counters */ size = ncpu * PCI_INTERRUPT_PIN_MAX * sizeof(rmixl_pcix_evcnt_t); - ev = malloc(size, M_DEVBUF, M_NOWAIT); - if (ev == NULL) - panic("%s: cannot malloc evcnts\n", __func__); + ev = malloc(size, M_DEVBUF, M_WAITOK); sc->sc_evcnts = ev; for (int pin=PCI_INTERRUPT_PIN_A; pin <= PCI_INTERRUPT_PIN_MAX; pin++) { for (int cpu=0; cpu < ncpu; cpu++) { @@ -982,14 +980,7 @@ rmixl_pcix_pip_add_1(rmixl_pcix_softc_t *sc, int irq, int ipl) * allocate and initialize softc intr struct * with one or more dispatch handles */ - pip_new = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO); - if (pip_new == NULL) { -#ifdef DIAGNOSTIC - printf("%s: cannot malloc\n", __func__); -#endif - return NULL; - } - + pip_new = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO); if (pip_old == NULL) { /* initialize the interrupt struct */ pip_new->sc = sc; diff --git a/sys/arch/mips/sibyte/dev/sbjcn.c b/sys/arch/mips/sibyte/dev/sbjcn.c index 047a4384f685..3fc8c36d7792 100644 --- a/sys/arch/mips/sibyte/dev/sbjcn.c +++ b/sys/arch/mips/sibyte/dev/sbjcn.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbjcn.c,v 1.30 2014/07/25 08:10:34 dholland Exp $ */ +/* $NetBSD: sbjcn.c,v 1.31 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright 2000, 2001 @@ -103,7 +103,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.30 2014/07/25 08:10:34 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.31 2019/11/10 21:16:30 chs Exp $"); #define SBJCN_DEBUG @@ -322,13 +322,7 @@ sbjcn_attach_channel(struct sbjcn_softc *sc, int chan, int intr) tp->t_hwiflow = sbjcn_hwiflow; ch->ch_tty = tp; - ch->ch_rbuf = malloc(sbjcn_rbuf_size << 1, M_DEVBUF, M_NOWAIT); - if (ch->ch_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "channel %d: unable to allocate ring buffer\n", - chan); - return; - } + ch->ch_rbuf = malloc(sbjcn_rbuf_size << 1, M_DEVBUF, M_WAITOK); ch->ch_ebuf = ch->ch_rbuf + (sbjcn_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/mips/sibyte/dev/sbscn.c b/sys/arch/mips/sibyte/dev/sbscn.c index 4fee75a67adf..4758f3ff9a0f 100644 --- a/sys/arch/mips/sibyte/dev/sbscn.c +++ b/sys/arch/mips/sibyte/dev/sbscn.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbscn.c,v 1.43 2017/07/24 09:56:46 mrg Exp $ */ +/* $NetBSD: sbscn.c,v 1.44 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright 2000, 2001 @@ -109,7 +109,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.43 2017/07/24 09:56:46 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.44 2019/11/10 21:16:30 chs Exp $"); #define SBSCN_DEBUG @@ -352,13 +352,7 @@ sbscn_attach_channel(struct sbscn_softc *sc, int chan, int intr) tp->t_hwiflow = sbscn_hwiflow; ch->ch_tty = tp; - ch->ch_rbuf = malloc(sbscn_rbuf_size << 1, M_DEVBUF, M_NOWAIT); - if (ch->ch_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "channel %d: unable to allocate ring buffer\n", - chan); - return; - } + ch->ch_rbuf = malloc(sbscn_rbuf_size << 1, M_DEVBUF, M_WAITOK); ch->ch_ebuf = ch->ch_rbuf + (sbscn_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/mipsco/isa/isa_machdep.c b/sys/arch/mipsco/isa/isa_machdep.c index 79a608ecad84..6f37a85a5d45 100644 --- a/sys/arch/mipsco/isa/isa_machdep.c +++ b/sys/arch/mipsco/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.15 2012/10/27 17:18:03 chs Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.16 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.15 2012/10/27 17:18:03 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.16 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -179,10 +179,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int intr, int type, int level, int (*ih { struct mipsco_intrhand *ih; - ih = malloc(sizeof *ih, M_DEVBUF, M_NOWAIT); - if (ih == NULL) - panic("isa_intr_establish: malloc failed"); - + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); ih->ih_fun = ih_fun; ih->ih_arg = ih_arg; LIST_INSERT_HEAD(&ic->intr_q, ih, ih_q); diff --git a/sys/arch/mvme68k/mvme68k/isr.c b/sys/arch/mvme68k/mvme68k/isr.c index 7860bfe420a5..1b8dde91ee22 100644 --- a/sys/arch/mvme68k/mvme68k/isr.c +++ b/sys/arch/mvme68k/mvme68k/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.33 2010/12/20 00:25:39 matt Exp $ */ +/* $NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33 2010/12/20 00:25:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -105,11 +105,7 @@ isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority, panic("%s: bad ipl %d", __func__, ipl); #endif - newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_NOWAIT); - if (newisr == NULL) - panic("%s: can't allocate space for isr", __func__); - - /* Fill in the new entry. */ + newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK); newisr->isr_func = func; newisr->isr_arg = arg; newisr->isr_ipl = ipl; diff --git a/sys/arch/mvmeppc/mvmeppc/mainbus.c b/sys/arch/mvmeppc/mvmeppc/mainbus.c index 830ab4ca3865..246c993141a5 100644 --- a/sys/arch/mvmeppc/mvmeppc/mainbus.c +++ b/sys/arch/mvmeppc/mvmeppc/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.16 2016/04/03 11:04:14 mlelstv Exp $ */ +/* $NetBSD: mainbus.c,v 1.17 2019/11/10 21:16:30 chs Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.16 2016/04/03 11:04:14 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.17 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -104,13 +104,11 @@ mainbus_attach(device_t parent, device_t self, void *aux) */ #if NPCI > 0 genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_NOWAIT); - KASSERT(genppc_pct != NULL); + M_WAITOK); mvmeppc_pci_get_chipset_tag(genppc_pct); pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); diff --git a/sys/arch/news68k/news68k/isr.c b/sys/arch/news68k/news68k/isr.c index bb76d63d8ba4..4f4ed390a474 100644 --- a/sys/arch/news68k/news68k/isr.c +++ b/sys/arch/news68k/news68k/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.21 2010/12/20 00:25:40 matt Exp $ */ +/* $NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.21 2010/12/20 00:25:40 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $"); #include #include @@ -82,12 +82,7 @@ isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority) if ((ipl < 0) || (ipl >= NISRAUTOVEC)) panic("isrlink_autovec: bad ipl %d", ipl); - newisr = (struct isr_autovec *)malloc(sizeof(struct isr_autovec), - M_DEVBUF, M_NOWAIT); - if (newisr == NULL) - panic("isrlink_autovec: can't allocate space for isr"); - - /* Fill in the new entry. */ + newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK); newisr->isr_func = func; newisr->isr_arg = arg; newisr->isr_ipl = ipl; diff --git a/sys/arch/newsmips/apbus/apbus.c b/sys/arch/newsmips/apbus/apbus.c index 7a7b4da635d9..d14cd98da9ea 100644 --- a/sys/arch/newsmips/apbus/apbus.c +++ b/sys/arch/newsmips/apbus/apbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: apbus.c,v 1.25 2018/10/14 00:10:11 tsutsui Exp $ */ +/* $NetBSD: apbus.c,v 1.26 2019/11/10 21:16:31 chs Exp $ */ /*- * Copyright (C) 1999 SHIMIZU Ryo. All rights reserved. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.25 2018/10/14 00:10:11 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.26 2019/11/10 21:16:31 chs Exp $"); #define __INTR_PRIVATE @@ -230,9 +230,7 @@ apbus_intr_establish(int level, int mask, int priority, int (*func)(void *), ip = &apintr_tab[level]; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - panic("%s: can't malloc handler info", __func__); + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_mask = mask; ih->ih_priority = priority; ih->ih_func = func; @@ -503,12 +501,10 @@ apbus_dmatag_init(struct apbus_attach_args *apa) { struct newsmips_bus_dma_tag *dmat; - dmat = malloc(sizeof(*dmat), M_DEVBUF, M_NOWAIT); - if (dmat != NULL) { - memcpy(dmat, &apbus_dma_tag, sizeof(*dmat)); - dmat->_slotno = apa->apa_slotno; - dmat->_slotbaset = 0; - dmat->_slotbaseh = apa->apa_hwbase; - } + dmat = malloc(sizeof(*dmat), M_DEVBUF, M_WAITOK); + memcpy(dmat, &apbus_dma_tag, sizeof(*dmat)); + dmat->_slotno = apa->apa_slotno; + dmat->_slotbaset = 0; + dmat->_slotbaseh = apa->apa_hwbase; return dmat; } diff --git a/sys/arch/newsmips/dev/hb.c b/sys/arch/newsmips/dev/hb.c index 39681fa167eb..e2261a113458 100644 --- a/sys/arch/newsmips/dev/hb.c +++ b/sys/arch/newsmips/dev/hb.c @@ -1,7 +1,7 @@ -/* $NetBSD: hb.c,v 1.19 2011/02/20 07:56:31 matt Exp $ */ +/* $NetBSD: hb.c,v 1.20 2019/11/10 21:16:31 chs Exp $ */ #include -__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.19 2011/02/20 07:56:31 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hb.c,v 1.20 2019/11/10 21:16:31 chs Exp $"); #define __INTR_PRIVATE #include @@ -99,10 +99,7 @@ hb_intr_establish(int level, int mask, int priority, int (*func)(void *), ip = &hbintr_tab[level]; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - panic("%s: malloc failed", __func__); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_level = level; diff --git a/sys/arch/next68k/dev/if_xe.c b/sys/arch/next68k/dev/if_xe.c index 41225c18a62e..2963045134cf 100644 --- a/sys/arch/next68k/dev/if_xe.c +++ b/sys/arch/next68k/dev/if_xe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xe.c,v 1.25 2019/04/25 08:31:33 msaitoh Exp $ */ +/* $NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.25 2019/04/25 08:31:33 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $"); #include "opt_inet.h" @@ -205,11 +205,7 @@ findchannel_defer(device_t self) * the 2000 covers at least a 1500 mtu + headers * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT */ - xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_NOWAIT); - if (!xsc->sc_txbuf) - panic("%s: can't malloc tx DMA buffer", - device_xname(sc->sc_dev)); - + xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_WAITOK); xsc->sc_tx_mb_head = NULL; xsc->sc_tx_loaded = 0; diff --git a/sys/arch/next68k/next68k/isr.c b/sys/arch/next68k/next68k/isr.c index 4478fe7f700c..826228f542b7 100644 --- a/sys/arch/next68k/next68k/isr.c +++ b/sys/arch/next68k/next68k/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.29 2017/03/31 08:38:13 msaitoh Exp $ */ +/* $NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $ */ /* * This file was taken from mvme68k/mvme68k/isr.c @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.29 2017/03/31 08:38:13 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $"); #include #include @@ -117,12 +117,7 @@ isrlink_autovec(int (*func)(void *), void *arg, int ipl, int priority, panic("isrlink_autovec: bad ipl %d", ipl); #endif - newisr = (struct isr_autovec *)malloc(sizeof(struct isr_autovec), - M_DEVBUF, M_NOWAIT); - if (newisr == NULL) - panic("isrlink_autovec: can't allocate space for isr"); - - /* Fill in the new entry. */ + newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK); newisr->isr_func = func; newisr->isr_arg = arg; newisr->isr_ipl = ipl; diff --git a/sys/arch/ofppc/pci/gt_mainbus.c b/sys/arch/ofppc/pci/gt_mainbus.c index bf04d881904e..c9029cf34631 100644 --- a/sys/arch/ofppc/pci/gt_mainbus.c +++ b/sys/arch/ofppc/pci/gt_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: gt_mainbus.c,v 1.4 2011/07/01 20:51:15 dyoung Exp $ */ +/* $NetBSD: gt_mainbus.c,v 1.5 2019/11/10 21:16:31 chs Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.4 2011/07/01 20:51:15 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gt_mainbus.c,v 1.5 2019/11/10 21:16:31 chs Exp $"); #include "opt_pci.h" #include "opt_marvell.h" @@ -276,8 +276,7 @@ gtpci_md_attach_hook(device_t parent, device_t self, struct genppc_pci_chipset_businfo *pbi; pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); SIMPLEQ_INIT(&genppc_gtpci1_chipset.pc_pbi); diff --git a/sys/arch/ofppc/pci/ofwpci.c b/sys/arch/ofppc/pci/ofwpci.c index 7b35cfe37dfc..1aa52c9da197 100644 --- a/sys/arch/ofppc/pci/ofwpci.c +++ b/sys/arch/ofppc/pci/ofwpci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofwpci.c,v 1.14 2017/01/11 18:19:29 christos Exp $ */ +/* $NetBSD: ofwpci.c,v 1.15 2019/11/10 21:16:31 chs Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.14 2017/01/11 18:19:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofwpci.c,v 1.15 2019/11/10 21:16:31 chs Exp $"); #include "opt_pci.h" @@ -200,8 +200,7 @@ ofwpci_attach(device_t parent, device_t self, void *aux) pc->pc_memt = &sc->sc_memt; pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); SIMPLEQ_INIT(&pc->pc_pbi); diff --git a/sys/arch/playstation2/dev/if_smap.c b/sys/arch/playstation2/dev/if_smap.c index 2318a567c948..a4edeaac8b38 100644 --- a/sys/arch/playstation2/dev/if_smap.c +++ b/sys/arch/playstation2/dev/if_smap.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_smap.c,v 1.30 2019/05/29 06:21:57 msaitoh Exp $ */ +/* $NetBSD: if_smap.c,v 1.31 2019/11/10 21:16:31 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.30 2019/05/29 06:21:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.31 2019/11/10 21:16:31 chs Exp $"); #include "debug_playstation2.h" @@ -193,20 +193,9 @@ smap_attach(struct device *parent, struct device *self, void *aux) /* allocate temporary buffer */ txbuf = malloc(ETHER_MAX_LEN - ETHER_CRC_LEN + SMAP_FIFO_ALIGN + 16, - M_DEVBUF, M_NOWAIT); - if (txbuf == NULL) { - printf("%s: no memory.\n", DEVNAME); - return; - } - + M_DEVBUF, M_WAITOK); rxbuf = malloc(ETHER_MAX_LEN + SMAP_FIFO_ALIGN + 16, - M_DEVBUF, M_NOWAIT); - if (rxbuf == NULL) { - printf("%s: no memory.\n", DEVNAME); - free(txbuf, M_DEVBUF); - return; - } - + M_DEVBUF, M_WAITOK); sc->tx_buf = (u_int32_t *)ROUND16((vaddr_t)txbuf); sc->rx_buf = (u_int32_t *)ROUND16((vaddr_t)rxbuf); diff --git a/sys/arch/pmax/tc/dt.c b/sys/arch/pmax/tc/dt.c index ceaf013fc4eb..7256d40f293b 100644 --- a/sys/arch/pmax/tc/dt.c +++ b/sys/arch/pmax/tc/dt.c @@ -1,4 +1,4 @@ -/* $NetBSD: dt.c,v 1.12 2015/06/28 09:15:45 maxv Exp $ */ +/* $NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ SOFTWARE. */ #include -__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.12 2015/06/28 09:15:45 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $"); #include #include @@ -215,12 +215,7 @@ dt_attach(device_t parent, device_t self, void *aux) dt_cninit(); - msg = malloc(sizeof(*msg) * DT_BUF_CNT, M_DEVBUF, M_NOWAIT); - if (msg == NULL) { - printf("%s: memory exhausted\n", device_xname(self)); - return; - } - + msg = malloc(sizeof(*msg) * DT_BUF_CNT, M_DEVBUF, M_WAITOK); sc->sc_sih = softint_establish(SOFTINT_SERIAL, dt_dispatch, sc); if (sc->sc_sih == NULL) { printf("%s: memory exhausted\n", device_xname(self)); diff --git a/sys/arch/prep/pci/gten.c b/sys/arch/prep/pci/gten.c index 74c270f0d19f..1ef40ccf80dc 100644 --- a/sys/arch/prep/pci/gten.c +++ b/sys/arch/prep/pci/gten.c @@ -1,4 +1,4 @@ -/* $NetBSD: gten.c,v 1.20 2011/07/01 16:56:52 dyoung Exp $ */ +/* $NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.20 2011/07/01 16:56:52 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $"); #include #include @@ -140,11 +140,7 @@ gten_attach(device_t parent, device_t self, void *aux) gt->gt_nscreens = 1; } else { gt->gt_ri = malloc(sizeof(*gt->gt_ri), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (gt->gt_ri == NULL) { - aprint_error(": can't alloc memory\n"); - return; - } + M_DEVBUF, M_WAITOK|M_ZERO); #if 0 error = pci_mapreg_map(pa, 0x14, PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, diff --git a/sys/arch/prep/pci/pci_machdep.c b/sys/arch/prep/pci/pci_machdep.c index 9f8c29707414..1eb2f33b4bfd 100644 --- a/sys/arch/prep/pci/pci_machdep.c +++ b/sys/arch/prep/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.42 2016/10/19 00:08:42 nonaka Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.42 2016/10/19 00:08:42 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $"); #include #include @@ -324,8 +324,7 @@ prep_pci_conf_hook(void *v, int bus, int dev, int func, pcireg_t id) if (PCI_CLASS(class) == PCI_CLASS_BRIDGE && PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_PCI) { pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); setup_pciintr_map(pbi, bus, dev, func); diff --git a/sys/arch/prep/pnpbus/nvram_pnpbus.c b/sys/arch/prep/pnpbus/nvram_pnpbus.c index bf8b301bb2e7..b63330aab38f 100644 --- a/sys/arch/prep/pnpbus/nvram_pnpbus.c +++ b/sys/arch/prep/pnpbus/nvram_pnpbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: nvram_pnpbus.c,v 1.21 2018/09/03 16:29:26 riastradh Exp $ */ +/* $NetBSD: nvram_pnpbus.c,v 1.22 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvram_pnpbus.c,v 1.21 2018/09/03 16:29:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvram_pnpbus.c,v 1.22 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -153,7 +153,7 @@ nvram_pnpbus_attach(device_t parent, device_t self, void *aux) */ nvlen = 1024 * prep_nvram_header.Size; - nvramData = malloc(nvlen, M_DEVBUF, M_NOWAIT); + nvramData = malloc(nvlen, M_DEVBUF, M_WAITOK); p = (uint8_t *) nvramData; /* diff --git a/sys/arch/prep/pnpbus/pnpbus.c b/sys/arch/prep/pnpbus/pnpbus.c index 637324775274..30aa99b61734 100644 --- a/sys/arch/prep/pnpbus/pnpbus.c +++ b/sys/arch/prep/pnpbus/pnpbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: pnpbus.c,v 1.11 2011/07/01 16:55:42 dyoung Exp $ */ +/* $NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.11 2011/07/01 16:55:42 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -102,7 +102,7 @@ pnp_newirq(void *v, struct pnpresources *r, int size) struct _S4_Pack *p = v; struct pnpbus_irq *irq; - irq = malloc(sizeof(struct pnpbus_irq), M_DEVBUF, M_NOWAIT); + irq = malloc(sizeof(struct pnpbus_irq), M_DEVBUF, M_WAITOK); irq->mask = le16dec(&p->IRQMask[0]); @@ -123,7 +123,7 @@ pnp_newdma(void *v, struct pnpresources *r, int size) struct _S5_Pack *p = v; struct pnpbus_dma *dma; - dma = malloc(sizeof(struct pnpbus_dma), M_DEVBUF, M_NOWAIT); + dma = malloc(sizeof(struct pnpbus_dma), M_DEVBUF, M_WAITOK); dma->mask = le16dec(&p->DMAMask); if (size > 2) @@ -144,7 +144,7 @@ pnp_newioport(void *v, struct pnpresources *r, int size) struct pnpbus_io *io; uint16_t mask; - io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_NOWAIT); + io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK); mask = p->IOInfo & ISAAddr16bit ? 0xffff : 0x03ff; io->minbase = (p->RangeMin[0] | (p->RangeMin[1] << 8)) & mask; io->maxbase = (p->RangeMax[0] | (p->RangeMax[1] << 8)) & mask; @@ -164,7 +164,7 @@ pnp_newfixedioport(void *v, struct pnpresources *r, int size) struct _S9_Pack *p = v; struct pnpbus_io *io; - io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_NOWAIT); + io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK); io->minbase = (p->Range[0] | (p->Range[1] << 8)) & 0x3ff; io->len = p->IONum; io->maxbase = -1; @@ -184,7 +184,7 @@ pnp_newiomem(void *v, struct pnpresources *r, int size) struct _L1_Pack *pack = v; if (pack->Count0 >= 0x9) { - mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_NOWAIT); + mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_WAITOK); mem->minbase = (pack->Data[2] << 16) | (pack->Data[1] << 8); mem->maxbase = (pack->Data[4] << 16) | (pack->Data[3] << 8); mem->align = (pack->Data[6] << 8) | pack->Data[5]; @@ -206,7 +206,7 @@ pnp_newaddr(void *v, struct pnpresources *r, int size) struct _L4_PPCPack *p = &pack->L4_Data.L4_PPCPack; if (p->PPCData[0] == 1) {/* type IO */ - io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_NOWAIT); + io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK); io->minbase = (uint16_t)le64dec(&p->PPCData[4]); io->maxbase = -1; io->align = p->PPCData[1]; @@ -217,7 +217,7 @@ pnp_newaddr(void *v, struct pnpresources *r, int size) return 0; } else if (p->PPCData[0] == 2) { - mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_NOWAIT); + mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_WAITOK); mem->minbase = (uint32_t)le64dec(&p->PPCData[4]); mem->maxbase = -1; mem->align = p->PPCData[1]; @@ -238,7 +238,7 @@ pnp_newcompatid(void *v, struct pnpresources *r, int size) struct pnpbus_compatid *id; uint32_t cid; - id = malloc(sizeof(*id), M_DEVBUF, M_NOWAIT); + id = malloc(sizeof(*id), M_DEVBUF, M_WAITOK); cid = le32dec(p->CompatId); pnp_devid_to_string(cid, id->idstr); id->next = r->compatids; diff --git a/sys/arch/prep/prep/mainbus.c b/sys/arch/prep/prep/mainbus.c index be0fedc2c4b7..169cd28ec76c 100644 --- a/sys/arch/prep/prep/mainbus.c +++ b/sys/arch/prep/prep/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.34 2018/08/27 17:17:25 martin Exp $ */ +/* $NetBSD: mainbus.c,v 1.35 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.34 2018/08/27 17:17:25 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.35 2019/11/10 21:16:32 chs Exp $"); #include "opt_pci.h" #include "opt_residual.h" @@ -127,13 +127,11 @@ mainbus_attach(device_t parent, device_t self, void *aux) */ #if NPCI > 0 genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_NOWAIT); - KASSERT(genppc_pct != NULL); + M_WAITOK); prep_pci_get_chipset_tag(genppc_pct); pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_NOWAIT); - KASSERT(pbi != NULL); + M_DEVBUF, M_WAITOK); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); diff --git a/sys/arch/rs6000/rs6000/pic_iocc.c b/sys/arch/rs6000/rs6000/pic_iocc.c index 3b84a26bee06..9262410f18b9 100644 --- a/sys/arch/rs6000/rs6000/pic_iocc.c +++ b/sys/arch/rs6000/rs6000/pic_iocc.c @@ -1,4 +1,4 @@ -/* $NetBSD: pic_iocc.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $ */ +/* $NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -59,9 +59,7 @@ setup_iocc(void) struct pic_ops *pic; int i; - pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_NOWAIT); - KASSERT(pic != NULL); - + pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK); pic->pic_numintrs = 16; pic->pic_cookie = (void *)NULL; pic->pic_enable_irq = iocc_enable_irq; diff --git a/sys/arch/sgimips/dev/int.c b/sys/arch/sgimips/dev/int.c index 21810ee3f15e..bdb5d13b96e8 100644 --- a/sys/arch/sgimips/dev/int.c +++ b/sys/arch/sgimips/dev/int.c @@ -1,4 +1,4 @@ -/* $NetBSD: int.c,v 1.29 2018/09/27 17:34:28 macallan Exp $ */ +/* $NetBSD: int.c,v 1.30 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright (c) 2009 Stephen M. Rumble @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.29 2018/09/27 17:34:28 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.30 2019/11/10 21:16:32 chs Exp $"); #define __INTR_PRIVATE #include "opt_cputype.h" @@ -372,12 +372,7 @@ int1_intr_establish(int level, int ipl, int (*handler) (void *), void *arg) } else { struct sgimips_intrhand *n, *ih; - ih = malloc(sizeof *ih, M_DEVBUF, M_NOWAIT); - if (ih == NULL) { - printf("int0: can't allocate handler\n"); - return (void *)NULL; - } - + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); ih->ih_fun = handler; ih->ih_arg = arg; ih->ih_next = NULL; @@ -416,12 +411,7 @@ int2_intr_establish(int level, int ipl, int (*handler) (void *), void *arg) } else { struct sgimips_intrhand *n, *ih; - ih = malloc(sizeof *ih, M_DEVBUF, M_NOWAIT); - if (ih == NULL) { - printf("int0: can't allocate handler\n"); - return NULL; - } - + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); ih->ih_fun = handler; ih->ih_arg = arg; ih->ih_next = NULL; diff --git a/sys/arch/sh3/dev/sci.c b/sys/arch/sh3/dev/sci.c index 26ded17a917e..af22999a1f5d 100644 --- a/sys/arch/sh3/dev/sci.c +++ b/sys/arch/sh3/dev/sci.c @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.61 2014/11/15 19:20:01 christos Exp $ */ +/* $NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.61 2014/11/15 19:20:01 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.62 2019/11/10 21:16:32 chs Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -416,12 +416,7 @@ sci_attach(device_t parent, device_t self, void *aux) tp->t_hwiflow = NULL; sc->sc_tty = tp; - sc->sc_rbuf = malloc(sci_rbuf_size << 1, M_DEVBUF, M_NOWAIT); - if (sc->sc_rbuf == NULL) { - printf("%s: unable to allocate ring buffer\n", - device_xname(self)); - return; - } + sc->sc_rbuf = malloc(sci_rbuf_size << 1, M_DEVBUF, M_WAITOK); sc->sc_ebuf = sc->sc_rbuf + (sci_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/sh3/dev/scif.c b/sys/arch/sh3/dev/scif.c index b6b1863afeb2..e85da8b59677 100644 --- a/sys/arch/sh3/dev/scif.c +++ b/sys/arch/sh3/dev/scif.c @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $ */ +/* $NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.66 2015/12/06 02:21:55 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.67 2019/11/10 21:16:32 chs Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -497,11 +497,7 @@ scif_attach(device_t parent, device_t self, void *aux) tp->t_hwiflow = NULL; sc->sc_tty = tp; - sc->sc_rbuf = malloc(scif_rbuf_size << 1, M_DEVBUF, M_NOWAIT); - if (sc->sc_rbuf == NULL) { - aprint_error_dev(self, "unable to allocate ring buffer\n"); - return; - } + sc->sc_rbuf = malloc(scif_rbuf_size << 1, M_DEVBUF, M_WAITOK); sc->sc_ebuf = sc->sc_rbuf + (scif_rbuf_size << 1); tty_attach(tp); diff --git a/sys/arch/shark/isa/isa_irqhandler.c b/sys/arch/shark/isa/isa_irqhandler.c index 6b8e3c76c5d2..1b04ab7997b1 100644 --- a/sys/arch/shark/isa/isa_irqhandler.c +++ b/sys/arch/shark/isa/isa_irqhandler.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_irqhandler.c,v 1.27 2014/09/21 15:48:29 christos Exp $ */ +/* $NetBSD: isa_irqhandler.c,v 1.28 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright 1997 @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.27 2014/09/21 15:48:29 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.28 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -311,10 +311,7 @@ intr_claim(int irq, int level, int (*ih_func)(void *), void *ih_arg, const char { irqhandler_t *ih; - ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT | M_ZERO); - if (!ih) - panic("intr_claim(): Cannot malloc handler memory"); - + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK | M_ZERO); ih->ih_level = level; ih->ih_func = ih_func; ih->ih_arg = ih_arg; diff --git a/sys/arch/shark/isa/isa_shark_machdep.c b/sys/arch/shark/isa/isa_shark_machdep.c index ac334be0bf1c..7f4dcf024760 100644 --- a/sys/arch/shark/isa/isa_shark_machdep.c +++ b/sys/arch/shark/isa/isa_shark_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_shark_machdep.c,v 1.16 2017/03/12 10:19:40 martin Exp $ */ +/* $NetBSD: isa_shark_machdep.c,v 1.17 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright 1997 @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.16 2017/03/12 10:19:40 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isa_shark_machdep.c,v 1.17 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -167,10 +167,7 @@ isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level, int (*ih_ { irqhandler_t *ih; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, M_ZERO | (cold ? M_NOWAIT : M_WAITOK)); - if (ih == NULL) - panic("isa_intr_establish: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_ZERO | M_WAITOK); if (!LEGAL_IRQ(irq) || type == IST_NONE) panic("intr_establish: bogus irq or type"); diff --git a/sys/arch/shark/ofw/if_cs_ofisa_machdep.c b/sys/arch/shark/ofw/if_cs_ofisa_machdep.c index 19ad01699532..fdaee348e11a 100644 --- a/sys/arch/shark/ofw/if_cs_ofisa_machdep.c +++ b/sys/arch/shark/ofw/if_cs_ofisa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_ofisa_machdep.c,v 1.12 2019/05/29 06:21:57 msaitoh Exp $ */ +/* $NetBSD: if_cs_ofisa_machdep.c,v 1.13 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright 1998 @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa_machdep.c,v 1.12 2019/05/29 06:21:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa_machdep.c,v 1.13 2019/11/10 21:16:32 chs Exp $"); #include "opt_compat_old_ofw.h" @@ -141,9 +141,7 @@ cs_ofisa_md_media_fixup(device_t parent, device_t self, void *aux, int *media, if (1) { /* XXX old firmware compat enabled */ if (media == NULL) { - media = malloc(2 * sizeof(int), M_TEMP, M_NOWAIT); - if (media == NULL) - return (NULL); + media = malloc(2 * sizeof(int), M_TEMP, M_WAITOK); media[0] = IFM_ETHER | IFM_10_T; media[1] = IFM_ETHER | IFM_10_T | IFM_FDX; *nmediap = 2; diff --git a/sys/arch/shark/ofw/igsfb_ofbus.c b/sys/arch/shark/ofw/igsfb_ofbus.c index f775ca0d5ac2..4669a8b45c04 100644 --- a/sys/arch/shark/ofw/igsfb_ofbus.c +++ b/sys/arch/shark/ofw/igsfb_ofbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: igsfb_ofbus.c,v 1.17 2017/01/22 17:27:31 jakllsch Exp $ */ +/* $NetBSD: igsfb_ofbus.c,v 1.18 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright (c) 2006 Michael Lorenz @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: igsfb_ofbus.c,v 1.17 2017/01/22 17:27:31 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igsfb_ofbus.c,v 1.18 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -230,9 +230,7 @@ igsfb_ofbus_attach(device_t parent, device_t self, void *aux) } else { isconsole = 0; sc->sc_dc = malloc(sizeof(struct igsfb_devconfig), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_dc == NULL) - panic("unable to allocate igsfb_devconfig"); + M_DEVBUF, M_WAITOK | M_ZERO); if (OF_getprop(oba->oba_phandle, "reg", regs, sizeof(regs)) <= 0) { diff --git a/sys/arch/shark/shark/profile.c b/sys/arch/shark/shark/profile.c index 4933f8ec9439..333dcfc5fd2a 100644 --- a/sys/arch/shark/shark/profile.c +++ b/sys/arch/shark/shark/profile.c @@ -1,4 +1,4 @@ -/* $NetBSD: profile.c,v 1.17 2016/07/07 06:55:38 msaitoh Exp $ */ +/* $NetBSD: profile.c,v 1.18 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright 1997 @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: profile.c,v 1.17 2016/07/07 06:55:38 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: profile.c,v 1.18 2019/11/10 21:16:32 chs Exp $"); #include "profiler.h" @@ -339,25 +339,14 @@ profStart(struct profStartInfo *info) /* alloc two hash tables. */ buffer = malloc(sizeof(struct profHashTable) + info->tableSize * sizeof(struct profHashEntry), - M_DEVBUF, M_NOWAIT); - if ( (buffer == NULL) ) - { - info->status = NO_MEMORY; - return; - } + M_DEVBUF, M_WAITOK); phashTables[0] = (struct profHashTable *) buffer; phashTables[0]->entries = (struct profHashEntry *) ( buffer + sizeof(struct profHashTable)); buffer = malloc(sizeof(struct profHashTable) + info->tableSize * sizeof(struct profHashEntry), - M_DEVBUF, M_NOWAIT); - if ( (buffer == NULL) ) - { - free(phashTables[0], M_DEVBUF); - info->status = NO_MEMORY; - return; - } + M_DEVBUF, M_WAITOK); phashTables[1] = (struct profHashTable *) buffer; phashTables[1]->entries = (struct profHashEntry *) ( buffer + sizeof(struct profHashTable)); diff --git a/sys/arch/sparc/dev/ebus.c b/sys/arch/sparc/dev/ebus.c index ac6033f52887..f13d00ba3ef3 100644 --- a/sys/arch/sparc/dev/ebus.c +++ b/sys/arch/sparc/dev/ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ebus.c,v 1.36 2019/10/18 04:09:02 msaitoh Exp $ */ +/* $NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright (c) 1999, 2000 Matthew R. Green @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.36 2019/10/18 04:09:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $"); #if defined(DEBUG) && !defined(EBUS_DEBUG) #define EBUS_DEBUG @@ -372,7 +372,7 @@ ebus_setup_attach_args(struct ebus_softc *sc, const struct msiiep_ebus_intr_wiring *w = &wiring_map[n]; if (strcmp(w->name, ea->ea_name) == 0) { ea->ea_intr = malloc(sizeof(uint32_t), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); ea->ea_intr[0] = w->line; ea->ea_nintr = 1; break; @@ -422,11 +422,7 @@ ebus_alloc_dma_tag(struct ebus_softc *sc, bus_dma_tag_t pdt) bus_dma_tag_t dt; dt = (bus_dma_tag_t) - malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_NOWAIT); - if (dt == NULL) - panic("unable to allocate ebus DMA tag"); - - memset(dt, 0, sizeof *dt); + malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_WAITOK | M_ZERO); dt->_cookie = sc; #define PCOPY(x) dt->x = pdt->x PCOPY(_dmamap_create); diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index 551713cbcd24..924c8301e600 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.159 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.160 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.159 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.160 2019/11/10 21:16:32 chs Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -2101,10 +2101,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == 0) - return (ENOMEM); - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/sparc/dev/rtc.c b/sys/arch/sparc/dev/rtc.c index 0afec573d242..699c4edcad5e 100644 --- a/sys/arch/sparc/dev/rtc.c +++ b/sys/arch/sparc/dev/rtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $ */ +/* $NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $ */ /* * Copyright (c) 2001 Valeriy E. Ushakov @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -135,8 +135,7 @@ rtcattach_ebus(device_t parent, device_t self, void *aux) /* setup our todr_handle */ handle = malloc(ALIGN(sizeof(struct todr_chip_handle)), - M_DEVBUF, M_NOWAIT); - + M_DEVBUF, M_WAITOK); handle->cookie = sc; handle->bus_cookie = NULL; /* unused */ handle->todr_gettime = rtc_gettime; diff --git a/sys/arch/sparc/dev/sbus.c b/sys/arch/sparc/dev/sbus.c index 0ae423de3c3e..0983d62cde2c 100644 --- a/sys/arch/sparc/dev/sbus.c +++ b/sys/arch/sparc/dev/sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbus.c,v 1.78 2012/09/23 09:54:04 jdc Exp $ */ +/* $NetBSD: sbus.c,v 1.79 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.78 2012/09/23 09:54:04 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.79 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -531,11 +531,7 @@ sbus_get_intr(struct sbus_softc *sc, int node, /* Change format to an `struct openprom_intr' array */ struct openprom_intr *ip; ip = malloc(*np * sizeof(struct openprom_intr), M_DEVBUF, - M_NOWAIT); - if (ip == NULL) { - free(ipl, M_DEVBUF); - return (ENOMEM); - } + M_WAITOK); for (n = 0; n < *np; n++) { ip[n].oi_pri = ipl[n]; ip[n].oi_vec = 0; @@ -579,10 +575,7 @@ sbus_intr_establish(bus_space_tag_t t, int pri, int level, struct intrhand *ih; int pil; - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); + ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_WAITOK); /* * Translate Sbus interrupt priority to CPU interrupt level diff --git a/sys/arch/sparc/dev/sw.c b/sys/arch/sparc/dev/sw.c index 8547e6a0f50f..9a1c8af827be 100644 --- a/sys/arch/sparc/dev/sw.c +++ b/sys/arch/sparc/dev/sw.c @@ -1,4 +1,4 @@ -/* $NetBSD: sw.c,v 1.23 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: sw.c,v 1.24 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -85,7 +85,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sw.c,v 1.23 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sw.c,v 1.24 2019/11/10 21:16:32 chs Exp $"); #include "opt_ddb.h" @@ -334,9 +334,7 @@ sw_attach(device_t parent, device_t self, void *aux) * Allocate DMA handles. */ i = SCI_OPENINGS * sizeof(struct sw_dma_handle); - sc->sc_dma = (struct sw_dma_handle *)malloc(i, M_DEVBUF, M_NOWAIT); - if (sc->sc_dma == NULL) - panic("sw: DMA handle malloc failed"); + sc->sc_dma = malloc(i, M_DEVBUF, M_WAITOK); for (i = 0; i < SCI_OPENINGS; i++) { sc->sc_dma[i].dh_flags = 0; diff --git a/sys/arch/sparc/dev/vme_machdep.c b/sys/arch/sparc/dev/vme_machdep.c index d00334b2c4cc..0b05f1c8df2b 100644 --- a/sys/arch/sparc/dev/vme_machdep.c +++ b/sys/arch/sparc/dev/vme_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.68 2012/10/27 17:18:11 chs Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.69 2019/11/10 21:16:32 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.68 2012/10/27 17:18:11 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.69 2019/11/10 21:16:32 chs Exp $"); #include #include @@ -719,8 +719,7 @@ sparc_vme_intr_map(void *cookie, int level, int vec, { struct sparc_vme_intr_handle *ih; - ih = (vme_intr_handle_t) - malloc(sizeof(struct sparc_vme_intr_handle), M_DEVBUF, M_NOWAIT); + ih = malloc(sizeof(struct sparc_vme_intr_handle), M_DEVBUF, M_WAITOK); ih->pri = level; ih->vec = vec; ih->sc = cookie;/*XXX*/ @@ -765,9 +764,7 @@ sparc_vme_intr_establish(void *cookie, vme_intr_handle_t vih, int level, break; if (ih == NULL) { - ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT|M_ZERO); - if (ih == NULL) - panic("vme_addirq"); + ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_WAITOK|M_ZERO); ih->ih_fun = sc->sc_vmeintr; ih->ih_arg = vih; intr_establish(pil, 0, ih, NULL, false); diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 36015482a4ba..241743867388 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.330 2019/04/06 03:06:27 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.331 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.330 2019/04/06 03:06:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.331 2019/11/10 21:16:33 chs Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_sunos.h" @@ -2794,9 +2794,7 @@ bus_space_tag_alloc(bus_space_tag_t parent, void *cookie) struct sparc_bus_space_tag *sbt; sbt = malloc(sizeof(struct sparc_bus_space_tag), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (sbt == NULL) - return (NULL); + M_DEVBUF, M_WAITOK|M_ZERO); if (parent) { memcpy(sbt, parent, sizeof(*sbt)); @@ -3014,11 +3012,7 @@ sparc_mainbus_intr_establish(bus_space_tag_t t, int pil, int level, { struct intrhand *ih; - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); - + ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_WAITOK); ih->ih_fun = handler; ih->ih_arg = arg; intr_establish(pil, level, ih, fastvec, false); diff --git a/sys/arch/sparc/sparc/msiiep.c b/sys/arch/sparc/sparc/msiiep.c index 31ca35a22eb0..f5f8bc2f55c3 100644 --- a/sys/arch/sparc/sparc/msiiep.c +++ b/sys/arch/sparc/sparc/msiiep.c @@ -1,4 +1,4 @@ -/* $NetBSD: msiiep.c,v 1.46 2015/10/04 08:17:43 joerg Exp $ */ +/* $NetBSD: msiiep.c,v 1.47 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 2001 Valeriy E. Ushakov @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: msiiep.c,v 1.46 2015/10/04 08:17:43 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msiiep.c,v 1.47 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -559,10 +559,7 @@ mspcic_intr_establish(bus_space_tag_t t, int line, int ipl, struct intrhand *ih; int pil; - ih = (struct intrhand *) - malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT); - if (ih == NULL) - return (NULL); + ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_WAITOK); /* use pil set-up by prom */ pil = mspcic_assigned_interrupt(line); diff --git a/sys/arch/sparc64/dev/cbus.c b/sys/arch/sparc64/dev/cbus.c index d6920308efa4..3ac98f93a854 100644 --- a/sys/arch/sparc64/dev/cbus.c +++ b/sys/arch/sparc64/dev/cbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cbus.c,v 1.2 2016/07/18 19:32:44 palle Exp $ */ +/* $NetBSD: cbus.c,v 1.3 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: cbus.c,v 1.15 2015/09/27 11:29:20 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -238,10 +238,7 @@ cbus_alloc_bus_tag(struct cbus_softc *sc, bus_space_tag_t parent) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("could not allocate cbus bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = parent; bt->sparc_bus_map = parent->sparc_bus_map; diff --git a/sys/arch/sparc64/dev/central.c b/sys/arch/sparc64/dev/central.c index 9c3026423b69..57222ce0736b 100644 --- a/sys/arch/sparc64/dev/central.c +++ b/sys/arch/sparc64/dev/central.c @@ -1,4 +1,4 @@ -/* $NetBSD: central.c,v 1.3 2012/03/18 05:26:58 mrg Exp $ */ +/* $NetBSD: central.c,v 1.4 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: central.c,v 1.7 2010/11/11 17:58:23 miod Exp $ */ /* @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: central.c,v 1.3 2012/03/18 05:26:58 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: central.c,v 1.4 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -126,10 +126,7 @@ central_get_string(int node, const char *name, char **buf) len = prom_getproplen(node, name); if (len < 0) return (len); - *buf = (char *)malloc(len + 1, M_DEVBUF, M_NOWAIT); - if (*buf == NULL) - return (-1); - + *buf = malloc(len + 1, M_DEVBUF, M_WAITOK); if (len != 0) prom_getpropstringA(node, name, *buf, len + 1); (*buf)[len] = '\0'; @@ -156,10 +153,7 @@ central_alloc_bus_tag(struct central_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("central: couldn't alloc bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = sc->sc_bt; #if 0 diff --git a/sys/arch/sparc64/dev/ebus.c b/sys/arch/sparc64/dev/ebus.c index c876caec3d46..4635b7850ea0 100644 --- a/sys/arch/sparc64/dev/ebus.c +++ b/sys/arch/sparc64/dev/ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ebus.c,v 1.63 2018/01/18 00:31:22 mrg Exp $ */ +/* $NetBSD: ebus.c,v 1.64 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.63 2018/01/18 00:31:22 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.64 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" @@ -365,12 +365,7 @@ ebus_alloc_bus_tag(struct ebus_softc *sc, int type) { bus_space_tag_t bt; - bt = (bus_space_tag_t) - malloc(sizeof(struct sparc_bus_space_tag), M_DEVBUF, M_NOWAIT); - if (bt == NULL) - panic("could not allocate ebus bus tag"); - - memset(bt, 0, sizeof *bt); + bt = malloc(sizeof(struct sparc_bus_space_tag), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = sc->sc_memtag; bt->type = type; diff --git a/sys/arch/sparc64/dev/ebus_mainbus.c b/sys/arch/sparc64/dev/ebus_mainbus.c index c277f7b03140..869bb2221e2a 100644 --- a/sys/arch/sparc64/dev/ebus_mainbus.c +++ b/sys/arch/sparc64/dev/ebus_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ebus_mainbus.c,v 1.16 2016/05/13 21:22:47 nakayama Exp $ */ +/* $NetBSD: ebus_mainbus.c,v 1.17 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.16 2016/05/13 21:22:47 nakayama Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.17 2019/11/10 21:16:33 chs Exp $"); #ifdef DEBUG #define EDB_PROM 0x01 @@ -186,10 +186,7 @@ ebus_mainbus_alloc_bus_tag(struct ebus_softc *sc, { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("could not allocate ebus bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = parent; bt->type = type; diff --git a/sys/arch/sparc64/dev/fdc.c b/sys/arch/sparc64/dev/fdc.c index e91c9ff3101a..5fae522c1203 100644 --- a/sys/arch/sparc64/dev/fdc.c +++ b/sys/arch/sparc64/dev/fdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc.c,v 1.47 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fdc.c,v 1.48 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.47 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.48 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -2288,10 +2288,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == 0) - return ENOMEM; - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/sparc64/dev/fhc.c b/sys/arch/sparc64/dev/fhc.c index 475415f59e19..dd725e351881 100644 --- a/sys/arch/sparc64/dev/fhc.c +++ b/sys/arch/sparc64/dev/fhc.c @@ -1,4 +1,4 @@ -/* $NetBSD: fhc.c,v 1.5 2016/07/07 06:55:38 msaitoh Exp $ */ +/* $NetBSD: fhc.c,v 1.6 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: fhc.c,v 1.17 2010/11/11 17:58:23 miod Exp $ */ /* @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.5 2016/07/07 06:55:38 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.6 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -151,10 +151,7 @@ fhc_get_string(int node, const char *name, char **buf) len = prom_getproplen(node, name); if (len < 0) return (len); - *buf = (char *)malloc(len + 1, M_DEVBUF, M_NOWAIT); - if (*buf == NULL) - return (-1); - + *buf = (char *)malloc(len + 1, M_DEVBUF, M_WAITOK); if (len != 0) prom_getpropstringA(node, name, *buf, len + 1); (*buf)[len] = '\0'; @@ -166,10 +163,7 @@ fhc_alloc_bus_tag(struct fhc_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("fhc: couldn't alloc bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = sc->sc_bt; bt->type = 0; /* XXX asi? */ diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index eed75e569438..8c1739e7c9c4 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $NetBSD: psycho.c,v 1.127 2019/02/05 06:10:53 mrg Exp $ */ +/* $NetBSD: psycho.c,v 1.128 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1999, 2000 Matthew R. Green @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.127 2019/02/05 06:10:53 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.128 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" @@ -464,10 +464,7 @@ found: * Allocate our psycho_pbm */ pp = sc->sc_psycho_this = malloc(sizeof *pp, M_DEVBUF, - M_NOWAIT | M_ZERO); - if (pp == NULL) - panic("could not allocate psycho pbm"); - + M_WAITOK | M_ZERO); pp->pp_sc = sc; /* grab the psycho ranges */ @@ -584,9 +581,7 @@ found: */ pp->pp_pc->spc_busnode = malloc(sizeof(*pp->pp_pc->spc_busnode), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (pp->pp_pc->spc_busnode == NULL) - panic("psycho_attach: malloc busnode"); + M_WAITOK | M_ZERO); /* * Setup IOMMU and PCI configuration if we're the first @@ -599,9 +594,7 @@ found: * For the moment, 32KB should be more than enough. */ sc->sc_is = malloc(sizeof(struct iommu_state), - M_DEVBUF, M_NOWAIT); - if (sc->sc_is == NULL) - panic("psycho_attach: malloc iommu_state"); + M_DEVBUF, M_WAITOK); /* Point the strbuf_ctl at the iommu_state */ pp->pp_sb.sb_is = sc->sc_is; @@ -765,9 +758,7 @@ psycho_alloc_chipset(struct psycho_pbm *pp, int node, pci_chipset_tag_t pc) { pci_chipset_tag_t npc; - npc = malloc(sizeof *npc, M_DEVBUF, M_NOWAIT); - if (npc == NULL) - panic("could not allocate pci_chipset_tag_t"); + npc = malloc(sizeof *npc, M_DEVBUF, M_WAITOK); memcpy(npc, pc, sizeof *pc); npc->cookie = pp; npc->rootnode = node; @@ -1083,9 +1074,7 @@ psycho_iommu_init(struct psycho_softc *sc, int tsbsize) } /* give us a nice name.. */ - name = (char *)malloc(32, M_DEVBUF, M_NOWAIT); - if (name == 0) - panic("couldn't malloc iommu name"); + name = malloc(32, M_DEVBUF, M_WAITOK); snprintf(name, 32, "%s dvma", device_xname(sc->sc_dev)); iommu_init(name, is, tsbsize, iobase); @@ -1100,11 +1089,8 @@ psycho_alloc_bus_tag(struct psycho_pbm *pp, int type) struct psycho_softc *sc = pp->pp_sc; bus_space_tag_t bt; - bt = (bus_space_tag_t) malloc(sizeof(struct sparc_bus_space_tag), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("could not allocate psycho bus tag"); - + bt = malloc(sizeof(struct sparc_bus_space_tag), + M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = pp; bt->parent = sc->sc_bustag; bt->type = type; @@ -1120,12 +1106,7 @@ psycho_alloc_dma_tag(struct psycho_pbm *pp) struct psycho_softc *sc = pp->pp_sc; bus_dma_tag_t dt, pdt = sc->sc_dmatag; - dt = (bus_dma_tag_t) - malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_NOWAIT); - if (dt == NULL) - panic("could not allocate psycho DMA tag"); - - memset(dt, 0, sizeof *dt); + dt = malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_WAITOK | M_ZERO); dt->_cookie = pp; dt->_parent = pdt; #define PCOPY(x) dt->x = pdt->x diff --git a/sys/arch/sparc64/dev/pyro.c b/sys/arch/sparc64/dev/pyro.c index 33321b5a46a8..202491635446 100644 --- a/sys/arch/sparc64/dev/pyro.c +++ b/sys/arch/sparc64/dev/pyro.c @@ -1,4 +1,4 @@ -/* $NetBSD: pyro.c,v 1.19 2019/04/21 11:45:08 maya Exp $ */ +/* $NetBSD: pyro.c,v 1.20 2019/11/10 21:16:33 chs Exp $ */ /* from: $OpenBSD: pyro.c,v 1.20 2010/12/05 15:15:14 kettenis Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.19 2019/04/21 11:45:08 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.20 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -185,10 +185,7 @@ pyro_init(struct pyro_softc *sc, int busa) struct pcibus_attach_args pba; int *busranges = NULL, nranges; - pbm = malloc(sizeof(*pbm), M_DEVBUF, M_NOWAIT | M_ZERO); - if (pbm == NULL) - panic("pyro: can't alloc pyro pbm"); - + pbm = malloc(sizeof(*pbm), M_DEVBUF, M_WAITOK | M_ZERO); pbm->pp_sc = sc; pbm->pp_bus_a = busa; @@ -221,9 +218,7 @@ pyro_init(struct pyro_softc *sc, int busa) pbm->pp_pc = pyro_alloc_chipset(pbm, sc->sc_node, &_sparc_pci_chipset); pbm->pp_pc->spc_busmax = busranges[1]; pbm->pp_pc->spc_busnode = malloc(sizeof(*pbm->pp_pc->spc_busnode), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (pbm->pp_pc->spc_busnode == NULL) - panic("pyro: malloc busnode"); + M_DEVBUF, M_WAITOK | M_ZERO); #if 0 pbm->pp_pc->bustag = pbm->pp_cfgt; @@ -263,9 +258,7 @@ pyro_init_iommu(struct pyro_softc *sc, struct pyro_pbm *pbm) /* We have no STC. */ is->is_sb[0] = NULL; - name = (char *)malloc(32, M_DEVBUF, M_NOWAIT); - if (name == NULL) - panic("couldn't malloc iommu name"); + name = malloc(32, M_DEVBUF, M_WAITOK); snprintf(name, 32, "%s dvma", device_xname(sc->sc_dev)); /* Tell iommu how to set the TSB size. */ @@ -399,9 +392,7 @@ pyro_alloc_bus_tag(struct pyro_pbm *pbm, const char *name, int type) struct pyro_softc *sc = pbm->pp_sc; struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("pyro: could not allocate bus tag"); + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); #if 0 snprintf(bt->name, sizeof(bt->name), "%s-pbm_%s(%d/%2.2x)", @@ -423,10 +414,7 @@ pyro_alloc_dma_tag(struct pyro_pbm *pbm) struct pyro_softc *sc = pbm->pp_sc; bus_dma_tag_t dt, pdt = sc->sc_dmat; - dt = malloc(sizeof(*dt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (dt == NULL) - panic("pyro: could not alloc dma tag"); - + dt = malloc(sizeof(*dt), M_DEVBUF, M_WAITOK | M_ZERO); dt->_cookie = pbm; dt->_parent = pdt; #define PCOPY(x) dt->x = pdt->x @@ -452,9 +440,7 @@ pyro_alloc_chipset(struct pyro_pbm *pbm, int node, pci_chipset_tag_t pc) { pci_chipset_tag_t npc; - npc = malloc(sizeof *npc, M_DEVBUF, M_NOWAIT); - if (npc == NULL) - panic("pyro: could not allocate pci_chipset_tag_t"); + npc = malloc(sizeof *npc, M_DEVBUF, M_WAITOK); memcpy(npc, pc, sizeof *pc); npc->cookie = pbm; npc->rootnode = node; diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c index 94053505ea61..26b5590bddf5 100644 --- a/sys/arch/sparc64/dev/sbus.c +++ b/sys/arch/sparc64/dev/sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbus.c,v 1.96 2016/11/10 06:44:35 macallan Exp $ */ +/* $NetBSD: sbus.c,v 1.97 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1999-2002 Eduardo Horvath @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.96 2016/11/10 06:44:35 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.97 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" @@ -246,9 +246,7 @@ sbus_attach(device_t parent, device_t self, void *aux) sc->sc_sb.sb_flush = &sc->sc_flush; /* give us a nice name.. */ - name = (char *)malloc(32, M_DEVBUF, M_NOWAIT); - if (name == 0) - panic("couldn't malloc iommu name"); + name = malloc(32, M_DEVBUF, M_WAITOK); snprintf(name, 32, "%s dvma", device_xname(self)); iommu_init(name, &sc->sc_is, 0, -1); @@ -455,9 +453,7 @@ sbus_get_intr(struct sbus_softc *sc, int node, struct openprom_intr **ipp, /* Change format to an `struct sbus_intr' array */ ip = malloc(*np * sizeof(struct openprom_intr), M_DEVBUF, - M_NOWAIT); - if (ip == NULL) - return (ENOMEM); + M_WAITOK); /* * Now things get ugly. We need to take this value which is @@ -595,12 +591,7 @@ sbus_alloc_dmatag(struct sbus_softc *sc) { bus_dma_tag_t sdt, psdt = sc->sc_dmatag; - sdt = (bus_dma_tag_t) - malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_NOWAIT); - if (sdt == NULL) - /* Panic? */ - return (psdt); - + sdt = malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_WAITOK); sdt->_cookie = sc; sdt->_parent = psdt; #define PCOPY(x) sdt->x = psdt->x diff --git a/sys/arch/sparc64/dev/upa.c b/sys/arch/sparc64/dev/upa.c index f1a8b492ed5d..29f58da53dbf 100644 --- a/sys/arch/sparc64/dev/upa.c +++ b/sys/arch/sparc64/dev/upa.c @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: upa.c,v 1.18 2012/03/18 05:26:58 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: upa.c,v 1.19 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -151,10 +151,7 @@ upa_alloc_bus_tag(struct upa_softc *sc) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("upa: couldn't alloc bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); *bt = *sc->sc_bt; bt->cookie = sc; bt->parent = sc->sc_bt; diff --git a/sys/arch/sparc64/dev/vbus.c b/sys/arch/sparc64/dev/vbus.c index 5d872dc963d6..8c3f7ca07024 100644 --- a/sys/arch/sparc64/dev/vbus.c +++ b/sys/arch/sparc64/dev/vbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: vbus.c,v 1.3 2017/02/17 20:53:17 palle Exp $ */ +/* $NetBSD: vbus.c,v 1.4 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: vbus.c,v 1.8 2015/09/27 11:29:20 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -155,9 +155,7 @@ vbus_intr_map(int node, int ino, uint64_t *sysino) len = OF_getproplen(parent, "interrupt-map-mask"); if (len < (address_cells + interrupt_cells) * sizeof(int)) return (-1); - imap_mask = malloc(len, M_DEVBUF, M_NOWAIT); - if (imap_mask == NULL) - return (-1); + imap_mask = malloc(len, M_DEVBUF, M_WAITOK); if (OF_getprop(parent, "interrupt-map-mask", imap_mask, len) != len) goto out; @@ -263,10 +261,7 @@ vbus_alloc_bus_tag(struct vbus_softc *sc, bus_space_tag_t parent) { struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("could not allocate vbus bus tag"); - + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); bt->cookie = sc; bt->parent = parent; bt->sparc_bus_map = parent->sparc_bus_map; diff --git a/sys/arch/sparc64/dev/vpci.c b/sys/arch/sparc64/dev/vpci.c index b5cb5a08e89e..adabc5e6748d 100644 --- a/sys/arch/sparc64/dev/vpci.c +++ b/sys/arch/sparc64/dev/vpci.c @@ -1,4 +1,4 @@ -/* $NetBSD: vpci.c,v 1.7 2016/05/10 19:23:59 palle Exp $ */ +/* $NetBSD: vpci.c,v 1.8 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 2015 Palle Lyckegaard * All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vpci.c,v 1.7 2016/05/10 19:23:59 palle Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vpci.c,v 1.8 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -200,10 +200,7 @@ vpci_init(struct vpci_softc *sc/*FIXME, int busa*/, struct mainbus_attach_args * struct pcibus_attach_args pba; int *busranges = NULL, nranges; - pbm = malloc(sizeof(*pbm), M_DEVBUF, M_NOWAIT | M_ZERO); - if (pbm == NULL) - panic("vpci: can't alloc vpci pbm"); - + pbm = malloc(sizeof(*pbm), M_DEVBUF, M_WAITOK | M_ZERO); pbm->vp_sc = sc; pbm->vp_devhandle = (ma->ma_reg[0].ur_paddr >> 32) & 0x0fffffff; #if 0 @@ -251,9 +248,7 @@ FIXME pbm->vp_pc = vpci_alloc_chipset(pbm, sc->sc_node, &_sparc_pci_chipset); pbm->vp_pc->spc_busmax = busranges[1]; pbm->vp_pc->spc_busnode = malloc(sizeof(*pbm->vp_pc->spc_busnode), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (pbm->vp_pc->spc_busnode == NULL) - panic("vpci: malloc busnode"); + M_DEVBUF, M_WAITOK | M_ZERO); #if 0 pbm->vp_pc->bustag = pbm->vp_cfgt; @@ -314,9 +309,7 @@ vpci_init_iommu(struct vpci_softc *sc, struct vpci_pbm *pbm) /* We have no STC. */ is->is_sb[0] = NULL; - name = (char *)malloc(32, M_DEVBUF, M_NOWAIT); - if (name == NULL) - panic("couldn't malloc iommu name"); + name = malloc(32, M_DEVBUF, M_WAITOK); snprintf(name, 32, "%s dvma", device_xname(sc->sc_dev)); /* Tell iommu how to set the TSB size. */ @@ -422,9 +415,7 @@ vpci_alloc_bus_tag(struct vpci_pbm *pbm, const char *name, int type) struct vpci_softc *sc = pbm->vp_sc; struct sparc_bus_space_tag *bt; - bt = malloc(sizeof(*bt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (bt == NULL) - panic("vpci: could not allocate bus tag"); + bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO); #if 0 snprintf(bt->name, sizeof(bt->name), "%s-pbm_%s(%d/%2.2x)", @@ -446,10 +437,7 @@ vpci_alloc_dma_tag(struct vpci_pbm *pbm) struct vpci_softc *sc = pbm->vp_sc; bus_dma_tag_t dt, pdt = sc->sc_dmat; - dt = malloc(sizeof(*dt), M_DEVBUF, M_NOWAIT | M_ZERO); - if (dt == NULL) - panic("vpci: could not alloc dma tag"); - + dt = malloc(sizeof(*dt), M_DEVBUF, M_WAITOK | M_ZERO); dt->_cookie = pbm; dt->_parent = pdt; #define PCOPY(x) dt->x = pdt->x @@ -475,9 +463,7 @@ vpci_alloc_chipset(struct vpci_pbm *pbm, int node, pci_chipset_tag_t pc) { pci_chipset_tag_t npc; - npc = malloc(sizeof *npc, M_DEVBUF, M_NOWAIT); - if (npc == NULL) - panic("vpci: could not allocate pci_chipset_tag_t"); + npc = malloc(sizeof *npc, M_DEVBUF, M_WAITOK); memcpy(npc, pc, sizeof *pc); npc->cookie = pbm; npc->rootnode = node; diff --git a/sys/arch/sparc64/dev/vrtc.c b/sys/arch/sparc64/dev/vrtc.c index ebfaedfd7805..9b3d7dd3391c 100644 --- a/sys/arch/sparc64/dev/vrtc.c +++ b/sys/arch/sparc64/dev/vrtc.c @@ -1,4 +1,4 @@ -/* $NetBSD: vrtc.c,v 1.1 2016/06/17 21:59:06 palle Exp $ */ +/* $NetBSD: vrtc.c,v 1.2 2019/11/10 21:16:33 chs Exp $ */ /* $OpenBSD: vrtc.c,v 1.1 2008/03/08 19:19:43 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -57,10 +57,7 @@ vrtc_attach(device_t parent, device_t self, void *aux) printf("\n"); - handle = malloc(sizeof(struct todr_chip_handle), M_DEVBUF,M_NOWAIT); - if (handle == NULL) - panic("couldn't allocate todr_handle"); - + handle = malloc(sizeof(struct todr_chip_handle), M_DEVBUF,M_WAITOK); handle->cookie = self; handle->todr_gettime = vrtc_gettime; handle->todr_settime = vrtc_settime; diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 6d21dd374587..a26901b2b2e2 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.291 2019/01/07 13:10:44 martin Exp $ */ +/* $NetBSD: machdep.c,v 1.292 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.291 2019/01/07 13:10:44 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.292 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -2183,9 +2183,7 @@ bus_space_tag_alloc(bus_space_tag_t parent, void *cookie) struct sparc_bus_space_tag *sbt; sbt = malloc(sizeof(struct sparc_bus_space_tag), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (sbt == NULL) - return (NULL); + M_DEVBUF, M_WAITOK|M_ZERO); if (parent) { memcpy(sbt, parent, sizeof(*sbt)); diff --git a/sys/arch/sun3/dev/eeprom.c b/sys/arch/sun3/dev/eeprom.c index 89b517edfd5c..6892ec4bd4d9 100644 --- a/sys/arch/sun3/dev/eeprom.c +++ b/sys/arch/sun3/dev/eeprom.c @@ -1,4 +1,4 @@ -/* $NetBSD: eeprom.c,v 1.32 2018/09/03 16:29:28 riastradh Exp $ */ +/* $NetBSD: eeprom.c,v 1.33 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: eeprom.c,v 1.32 2018/09/03 16:29:28 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: eeprom.c,v 1.33 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -105,9 +105,7 @@ eeprom_attach(device_t parent, device_t self, void *args) panic("%s: can't map va", __func__); /* Keep a "soft" copy of the EEPROM to make access simpler. */ - eeprom_copy = malloc(ee_size, M_DEVBUF, M_NOWAIT); - if (eeprom_copy == NULL) - panic("%s: malloc eeprom_copy", __func__); + eeprom_copy = malloc(ee_size, M_DEVBUF, M_WAITOK); /* * On the 3/80, do not touch the last 40 bytes! diff --git a/sys/arch/sun3/dev/fd.c b/sys/arch/sun3/dev/fd.c index 2f35d398c72b..e3a704308d4d 100644 --- a/sys/arch/sun3/dev/fd.c +++ b/sys/arch/sun3/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.82 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.83 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.82 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.83 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" @@ -1734,10 +1734,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == 0) - return ENOMEM; - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index ab1297055c4d..cfc580bf35f9 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.73 2015/04/26 15:15:19 mlelstv Exp $ */ +/* $NetBSD: xd.c,v 1.74 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1995 Charles D. Cranor @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.73 2015/04/26 15:15:19 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.74 2019/11/10 21:16:33 chs Exp $"); #undef XDC_DEBUG /* full debug */ #define XDC_DIAG /* extra sanity checks */ @@ -447,9 +447,7 @@ xdcattach(device_t parent, device_t self, void *aux) xdc->dvmaiopb = (struct xd_iopb *)dvma_kvtopa(xdc->iopbase, xdc->bustype); xdc->reqs = malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (xdc->reqs == NULL) - panic("xdc malloc"); + M_DEVBUF, M_WAITOK | M_ZERO); /* init free list, iorq to iopb pointers, and non-zero fields in the * iopb which never change. */ diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index e35e2350d238..678862c9efd3 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.78 2015/04/26 15:15:19 mlelstv Exp $ */ +/* $NetBSD: xy.c,v 1.79 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1995 Charles D. Cranor @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.78 2015/04/26 15:15:19 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.79 2019/11/10 21:16:33 chs Exp $"); #undef XYC_DEBUG /* full debug */ #undef XYC_DIAG /* extra sanity checks */ @@ -391,9 +391,7 @@ xycattach(device_t parent, device_t self, void *aux) xyc->dvmaiopb = (struct xy_iopb *)dvma_kvtopa(xyc->iopbase, xyc->bustype); xyc->reqs = malloc(XYC_MAXIOPB * sizeof(struct xy_iorq), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (xyc->reqs == NULL) - panic("xyc malloc"); + M_DEVBUF, M_WAITOK | M_ZERO); /* * init iorq to iopb pointers, and non-zero fields in the diff --git a/sys/arch/sun68k/sun68k/isr.c b/sys/arch/sun68k/sun68k/isr.c index 0b350ab5e83b..8937205aeedf 100644 --- a/sys/arch/sun68k/sun68k/isr.c +++ b/sys/arch/sun68k/sun68k/isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: isr.c,v 1.24 2010/12/20 00:25:45 matt Exp $ */ +/* $NetBSD: isr.c,v 1.25 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.24 2010/12/20 00:25:45 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.25 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -147,10 +147,7 @@ isr_add_autovect(isr_func_t handler, void *arg, int level) if ((level < 0) || (level >= NUM_LEVELS)) panic("isr_add: bad level=%d", level); - new_isr = malloc(sizeof(struct isr), M_DEVBUF, M_NOWAIT); - if (new_isr == NULL) - panic("isr_add: malloc failed"); - + new_isr = malloc(sizeof(struct isr), M_DEVBUF, M_WAITOK); new_isr->isr_intr = handler; new_isr->isr_arg = arg; new_isr->isr_ipl = level; diff --git a/sys/arch/sun68k/sun68k/vme_sun68k.c b/sys/arch/sun68k/sun68k/vme_sun68k.c index 9b9467eea128..cefce5cd6b0b 100644 --- a/sys/arch/sun68k/sun68k/vme_sun68k.c +++ b/sys/arch/sun68k/sun68k/vme_sun68k.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_sun68k.c,v 1.15 2009/11/27 03:23:14 rmind Exp $ */ +/* $NetBSD: vme_sun68k.c,v 1.16 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_sun68k.c,v 1.15 2009/11/27 03:23:14 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_sun68k.c,v 1.16 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -269,7 +269,7 @@ sun68k_vme_intr_map(void *cookie, int level, int vec, vme_intr_handle_t *ihp) struct sun68k_vme_intr_handle *svih; svih = malloc(sizeof(struct sun68k_vme_intr_handle), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); svih->pri = level; svih->vec = vec; *ihp = svih; diff --git a/sys/arch/vax/uba/qvkbd.c b/sys/arch/vax/uba/qvkbd.c index 0278e860c546..32ae01038193 100644 --- a/sys/arch/vax/uba/qvkbd.c +++ b/sys/arch/vax/uba/qvkbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: qvkbd.c,v 1.1 2015/07/05 03:07:21 matt Exp $ */ +/* $NetBSD: qvkbd.c,v 1.2 2019/11/10 21:16:33 chs Exp $ */ /* Copyright (c) 2015 Charles H. Dickman. All rights reserved. * Derived from dzkbd.c @@ -172,7 +172,7 @@ qvkbd_attach(device_t parent, device_t self, void *aux) qvi = &qvkbd_console_internal; } else { qvi = malloc(sizeof(struct qvkbd_internal), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); qvi->qvi_ks.attmt.sendchar = qvkbd_sendchar; qvi->qvi_ks.attmt.cookie = ls; } @@ -312,4 +312,3 @@ qvkbd_input(void *v, int data) } while (decode == LKD_MORE); return(1); } - diff --git a/sys/arch/vax/vax/multicpu.c b/sys/arch/vax/vax/multicpu.c index eff336e0a515..1c352fdc97a1 100644 --- a/sys/arch/vax/vax/multicpu.c +++ b/sys/arch/vax/vax/multicpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: multicpu.c,v 1.34 2017/05/22 16:53:05 ragge Exp $ */ +/* $NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.34 2017/05/22 16:53:05 ragge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $"); #include "opt_multiprocessor.h" @@ -86,10 +86,7 @@ cpu_slavesetup(device_t self, int slotid) KASSERT(device_private(self) == NULL); - ci = malloc(sizeof(*ci), M_DEVBUF, M_ZERO|M_NOWAIT); - if (ci == NULL) - panic("cpu_slavesetup1"); - + ci = malloc(sizeof(*ci), M_DEVBUF, M_ZERO|M_WAITOK); self->dv_private = ci; ci->ci_dev = self; ci->ci_slotid = slotid; @@ -107,10 +104,7 @@ cpu_slavesetup(device_t self, int slotid) ci->ci_istack = istackbase + PAGE_SIZE; SIMPLEQ_INSERT_TAIL(&cpus, ci, ci_next); - cq = malloc(sizeof(*cq), M_TEMP, M_NOWAIT|M_ZERO); - if (cq == NULL) - panic("cpu_slavesetup3"); - + cq = malloc(sizeof(*cq), M_TEMP, M_WAITOK|M_ZERO); cq->cq_ci = ci; cq->cq_dev = ci->ci_dev; SIMPLEQ_INSERT_TAIL(&cpuq, cq, cq_q); diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index 6f41f5516f99..5e3cd73b178a 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $ */ +/* $NetBSD: pmap.c,v 1.187 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.186 2018/03/30 08:34:35 ragge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.187 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" #include "opt_cputype.h" @@ -104,8 +104,6 @@ extern void *msgbufaddr; #define NPTEPG 0x80 /* # of PTEs per page (logical or physical) */ #define PPTESZ sizeof(struct pte) #define NOVADDR 0xffffffff /* Illegal virtual address */ -#define WAITOK M_WAITOK -#define NOWAIT M_NOWAIT #define NPTEPERREG 0x200000 #define SEGTYPE(x) (((unsigned int)(x)) >> 30) diff --git a/sys/arch/x68k/dev/fd.c b/sys/arch/x68k/dev/fd.c index 973d5eece94a..26ab15dda2aa 100644 --- a/sys/arch/x68k/dev/fd.c +++ b/sys/arch/x68k/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.122 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.123 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.122 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.123 2019/11/10 21:16:33 chs Exp $"); #include "opt_ddb.h" #include "opt_m68k_arch.h" @@ -1734,10 +1734,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == NULL) - return ENOMEM; - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/arch/x68k/dev/intio.c b/sys/arch/x68k/dev/intio.c index 84b4733cfa2b..63bf42865400 100644 --- a/sys/arch/x68k/dev/intio.c +++ b/sys/arch/x68k/dev/intio.c @@ -1,4 +1,4 @@ -/* $NetBSD: intio.c,v 1.45 2016/05/31 03:12:49 dholland Exp $ */ +/* $NetBSD: intio.c,v 1.46 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.45 2016/05/31 03:12:49 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.46 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -327,9 +327,7 @@ intio_intr_establish_ext(int vector, const char *name1, const char *name2, if (iiv[vector].iiv_handler) return EBUSY; - evcnt = malloc(sizeof(*evcnt), M_DEVBUF, M_NOWAIT); - if (evcnt == NULL) - return ENOMEM; + evcnt = malloc(sizeof(*evcnt), M_DEVBUF, M_WAITOK); evcnt_attach_dynamic(evcnt, EVCNT_TYPE_INTR, NULL, name1, name2); iiv[vector].iiv_handler = handler; diff --git a/sys/arch/x68k/dev/neptune.c b/sys/arch/x68k/dev/neptune.c index d05a71e33eda..f7485c926b4c 100644 --- a/sys/arch/x68k/dev/neptune.c +++ b/sys/arch/x68k/dev/neptune.c @@ -1,4 +1,4 @@ -/* $NetBSD: neptune.c,v 1.20 2014/03/26 08:17:59 christos Exp $ */ +/* $NetBSD: neptune.c,v 1.21 2019/11/10 21:16:33 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: neptune.c,v 1.20 2014/03/26 08:17:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: neptune.c,v 1.21 2019/11/10 21:16:33 chs Exp $"); #include #include @@ -108,9 +108,7 @@ neptune_attach(device_t parent, device_t self, void *aux) panic("IO map for Neptune corruption??"); #endif - sc->sc_bst = malloc(sizeof(struct x68k_bus_space), M_DEVBUF, M_NOWAIT); - if (sc->sc_bst == NULL) - panic("neptune_attach: can't allocate bus_space structure"); + sc->sc_bst = malloc(sizeof(struct x68k_bus_space), M_DEVBUF, M_WAITOK); *sc->sc_bst = neptune_bus; sc->sc_bst->x68k_bus_device = self; diff --git a/sys/arch/x68k/dev/opmbell.c b/sys/arch/x68k/dev/opmbell.c index 3ad13a1201fe..c158496aa7c0 100644 --- a/sys/arch/x68k/dev/opmbell.c +++ b/sys/arch/x68k/dev/opmbell.c @@ -1,4 +1,4 @@ -/* $NetBSD: opmbell.c,v 1.27 2015/08/22 14:11:19 christos Exp $ */ +/* $NetBSD: opmbell.c,v 1.28 2019/11/10 21:16:33 chs Exp $ */ /* * Copyright (c) 1995 MINOURA Makoto, Takuya Harakawa. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: opmbell.c,v 1.27 2015/08/22 14:11:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: opmbell.c,v 1.28 2019/11/10 21:16:33 chs Exp $"); #include "bell.h" #if NBELL > 0 @@ -142,12 +142,7 @@ bellattach(int num) return; callout_init(&bell_ch, 0); size = num * sizeof(struct bell_softc); - bell_softc = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); - if (bell_softc == NULL) { - printf("WARNING: no memory for opm bell\n"); - return; - } - + bell_softc = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); for (unit = 0; unit < num; unit++) { sc = &bell_softc[unit]; sc->sc_flags = BELLF_ALIVE; diff --git a/sys/arch/x86/x86/sys_machdep.c b/sys/arch/x86/x86/sys_machdep.c index 47906ba115e4..28a103929089 100644 --- a/sys/arch/x86/x86/sys_machdep.c +++ b/sys/arch/x86/x86/sys_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.51 2019/02/11 14:59:33 cherry Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.52 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 1998, 2007, 2009, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.51 2019/02/11 14:59:33 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.52 2019/11/10 21:16:34 chs Exp $"); #include "opt_mtrr.h" #include "opt_user_ldt.h" @@ -190,10 +190,7 @@ x86_set_ldt(struct lwp *l, void *args, register_t *retval) if (ua.num < 0 || ua.num > 8192) return EINVAL; - descv = malloc(sizeof (*descv) * ua.num, M_TEMP, M_NOWAIT); - if (descv == NULL) - return ENOMEM; - + descv = malloc(sizeof (*descv) * ua.num, M_TEMP, M_WAITOK); error = copyin(ua.desc, descv, sizeof (*descv) * ua.num); if (error == 0) error = x86_set_ldt1(l, &ua, descv); diff --git a/sys/arch/x86/x86/x86_autoconf.c b/sys/arch/x86/x86/x86_autoconf.c index 5b9cbbb044f4..660b6ad01f67 100644 --- a/sys/arch/x86/x86/x86_autoconf.c +++ b/sys/arch/x86/x86/x86_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: x86_autoconf.c,v 1.78 2019/05/24 14:28:48 nonaka Exp $ */ +/* $NetBSD: x86_autoconf.c,v 1.79 2019/11/10 21:16:34 chs Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.78 2019/05/24 14:28:48 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.79 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -137,10 +137,7 @@ matchbiosdisks(void) sizeof(struct nativedisk_info); /* XXX M_TEMP is wrong */ - x86_alldisks = malloc(dklist_size, M_TEMP, M_NOWAIT | M_ZERO); - if (x86_alldisks == NULL) - return; - + x86_alldisks = malloc(dklist_size, M_TEMP, M_WAITOK | M_ZERO); x86_alldisks->dl_nnativedisks = x86_ndisks; x86_alldisks->dl_nbiosdisks = numbig; for (i = 0; i < numbig; i++) { diff --git a/sys/arch/xen/xen/xengnt.c b/sys/arch/xen/xen/xengnt.c index 1b995847d710..db8247094bb3 100644 --- a/sys/arch/xen/xen/xengnt.c +++ b/sys/arch/xen/xen/xengnt.c @@ -1,4 +1,4 @@ -/* $NetBSD: xengnt.c,v 1.26 2019/02/06 12:24:46 cherry Exp $ */ +/* $NetBSD: xengnt.c,v 1.27 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.26 2019/02/06 12:24:46 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.27 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -98,9 +98,7 @@ xengnt_init(void) if (grant_table == NULL) panic("xengnt_init() no VM space"); gnt_entries = malloc((nr_grant_entries + 1) * sizeof(grant_ref_t), - M_DEVBUF, M_NOWAIT); - if (gnt_entries == NULL) - panic("xengnt_init() no space for bitmask"); + M_DEVBUF, M_WAITOK); for (i = 0; i <= nr_grant_entries; i++) gnt_entries[i] = XENGNT_NO_ENTRY; diff --git a/sys/arch/xen/xenbus/xenbus_client.c b/sys/arch/xen/xenbus/xenbus_client.c index ad7ed02cee72..be841003bdc4 100644 --- a/sys/arch/xen/xenbus/xenbus_client.c +++ b/sys/arch/xen/xenbus/xenbus_client.c @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_client.c,v 1.13 2014/09/21 12:46:15 bouyer Exp $ */ +/* $NetBSD: xenbus_client.c,v 1.14 2019/11/10 21:16:34 chs Exp $ */ /****************************************************************************** * Client-facing interface for the Xenbus driver. In other words, the * interface between the Xenbus and the device-specific code, be it the @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.13 2014/09/21 12:46:15 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.14 2019/11/10 21:16:34 chs Exp $"); #if 0 #define DPRINTK(fmt, args...) \ @@ -86,11 +86,7 @@ xenbus_watch_path2(struct xenbus_device *dev, const char *path, DPRINTK("xenbus_watch_path2 path %s path2 %s\n", path, path2); state = malloc(strlen(path) + 1 + strlen(path2) + 1, M_DEVBUF, - M_NOWAIT); - if (!state) { - xenbus_dev_fatal(dev, ENOMEM, "allocating path for watch"); - return ENOMEM; - } + M_WAITOK); strcpy(state, path); strcat(state, "/"); strcat(state, path2); diff --git a/sys/arch/zaurus/dev/w100.c b/sys/arch/zaurus/dev/w100.c index 282fdfb80471..2ed5d14151f2 100644 --- a/sys/arch/zaurus/dev/w100.c +++ b/sys/arch/zaurus/dev/w100.c @@ -1,4 +1,4 @@ -/* $NetBSD: w100.c,v 1.1 2012/01/29 10:12:42 tsutsui Exp $ */ +/* $NetBSD: w100.c,v 1.2 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. * Written by Hiroyuki Bessho for Genetec Corporation. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: w100.c,v 1.1 2012/01/29 10:12:42 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: w100.c,v 1.2 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -235,12 +235,7 @@ w100_new_screen(struct w100_softc *sc, int depth, struct w100_screen **scrpp) struct w100_screen *scr = NULL; int error = 0; - scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); - if (scr == NULL) - return ENOMEM; - - memset(scr, 0, sizeof(*scr)); - + scr = malloc(sizeof(*scr), M_DEVBUF, M_WAITOK | M_ZERO); scr->buf_va = (u_char *)bus_space_vaddr(sc->iot, sc->ioh_vram); scr->depth = depth; diff --git a/sys/arch/zaurus/dev/zkbd.c b/sys/arch/zaurus/dev/zkbd.c index aeb2847ec693..d4288e04a91c 100644 --- a/sys/arch/zaurus/dev/zkbd.c +++ b/sys/arch/zaurus/dev/zkbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: zkbd.c,v 1.18 2013/03/30 08:35:06 nonaka Exp $ */ +/* $NetBSD: zkbd.c,v 1.19 2019/11/10 21:16:34 chs Exp $ */ /* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.18 2013/03/30 08:35:06 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.19 2019/11/10 21:16:34 chs Exp $"); #include "opt_wsdisplay_compat.h" #if 0 /* XXX */ @@ -284,12 +284,9 @@ zkbd_attach(device_t parent, device_t self, void *aux) "couldn't establish power handler\n"); sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - memset(sc->sc_okeystate, 0, sc->sc_nsense * sc->sc_nstrobe); - + M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe, - M_DEVBUF, M_NOWAIT); - memset(sc->sc_keystate, 0, sc->sc_nsense * sc->sc_nstrobe); + M_DEVBUF, M_WAITOK | M_ZERO); /* set all the strobe bits */ for (i = 0; i < sc->sc_nstrobe; i++) { diff --git a/sys/dev/acpi/acpi_pci_link.c b/sys/dev/acpi/acpi_pci_link.c index 10ff71acec00..2fecc2f1412b 100644 --- a/sys/dev/acpi/acpi_pci_link.c +++ b/sys/dev/acpi/acpi_pci_link.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci_link.c,v 1.22 2014/09/14 19:54:05 mrg Exp $ */ +/* $NetBSD: acpi_pci_link.c,v 1.23 2019/11/10 21:16:34 chs Exp $ */ /*- * Copyright (c) 2002 Mitsuru IWASAKI @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.22 2014/09/14 19:54:05 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.23 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -1150,10 +1150,7 @@ acpi_pci_link_devbyhandle(ACPI_HANDLE handle) return sc; } - sc = malloc(sizeof (*sc), M_ACPI, M_NOWAIT | M_ZERO); - if (sc == NULL) - return NULL; - + sc = malloc(sizeof (*sc), M_ACPI, M_WAITOK | M_ZERO); sc->pl_handle = handle; acpi_pci_link_init(sc); diff --git a/sys/dev/bio.c b/sys/dev/bio.c index 5d52d6eb8752..efc7457b1d36 100644 --- a/sys/dev/bio.c +++ b/sys/dev/bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: bio.c,v 1.15 2019/03/01 11:06:56 pgoyette Exp $ */ +/* $NetBSD: bio.c,v 1.16 2019/11/10 21:16:34 chs Exp $ */ /* $OpenBSD: bio.c,v 1.9 2007/03/20 02:35:55 marco Exp $ */ /* @@ -28,7 +28,7 @@ /* A device controller ioctl tunnelling device. */ #include -__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.15 2019/03/01 11:06:56 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bio.c,v 1.16 2019/11/10 21:16:34 chs Exp $"); #include "opt_compat_netbsd.h" @@ -208,9 +208,7 @@ bio_register(device_t dev, int (*ioctl)(device_t, u_long, void *)) if (!bio_lock_initialized) bio_initialize(); - bm = malloc(sizeof(*bm), M_DEVBUF, M_NOWAIT|M_ZERO); - if (bm == NULL) - return ENOMEM; + bm = malloc(sizeof(*bm), M_DEVBUF, M_WAITOK|M_ZERO); bm->bm_dev = dev; bm->bm_ioctl = ioctl; mutex_enter(&bio_lock); diff --git a/sys/dev/cardbus/ahc_cardbus.c b/sys/dev/cardbus/ahc_cardbus.c index 99f1e31365a2..562fee895a98 100644 --- a/sys/dev/cardbus/ahc_cardbus.c +++ b/sys/dev/cardbus/ahc_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahc_cardbus.c,v 1.37 2018/04/02 11:02:52 rin Exp $ */ +/* $NetBSD: ahc_cardbus.c,v 1.38 2019/11/10 21:16:34 chs Exp $ */ /*- * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.37 2018/04/02 11:02:52 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.38 2019/11/10 21:16:34 chs Exp $"); #include "opt_ahc_cardbus.h" @@ -200,10 +200,7 @@ ahc_cardbus_attach(device_t parent, device_t self, void *aux) } ahc->seep_config = malloc(sizeof(*ahc->seep_config), - M_DEVBUF, M_NOWAIT); - if (ahc->seep_config == NULL) - return; - + M_DEVBUF, M_WAITOK); ahc_check_extport(ahc, &sxfrctl1); /* * Take the LED out of diagnostic mode. diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 427424e042bd..3ea6bd6105a0 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cardbus.c,v 1.108 2011/08/01 11:20:27 drochner Exp $ */ +/* $NetBSD: cardbus.c,v 1.109 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 1997, 1998, 1999 and 2000 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.108 2011/08/01 11:20:27 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.109 2019/11/10 21:16:34 chs Exp $"); #include "opt_cardbus.h" @@ -557,11 +557,8 @@ cardbus_rescan(device_t self, const char *ifattr, * We need to allocate the ct here, since we might * need it when reading the CIS */ - if ((ct = malloc(sizeof(struct cardbus_devfunc), - M_DEVBUF, M_NOWAIT)) == NULL) { - panic("no room for cardbus_tag"); - } - + ct = malloc(sizeof(struct cardbus_devfunc), + M_DEVBUF, M_WAITOK); ct->ct_bhlc = bhlc; ct->ct_cc = sc->sc_cc; ct->ct_cf = sc->sc_cf; diff --git a/sys/dev/cardbus/cardbus_exrom.c b/sys/dev/cardbus/cardbus_exrom.c index 509fa12413ff..1b8d0f0015f0 100644 --- a/sys/dev/cardbus/cardbus_exrom.c +++ b/sys/dev/cardbus/cardbus_exrom.c @@ -1,4 +1,4 @@ -/* $NetBSD: cardbus_exrom.c,v 1.13 2018/09/03 16:29:30 riastradh Exp $ */ +/* $NetBSD: cardbus_exrom.c,v 1.14 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cardbus_exrom.c,v 1.13 2018/09/03 16:29:30 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardbus_exrom.c,v 1.14 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -121,11 +121,7 @@ cardbus_read_exrom(bus_space_tag_t romt, bus_space_handle_t romh, */ image_size = 1; image_size <<= 9; - image = malloc(sizeof(*image), M_DEVBUF, M_NOWAIT); - if (image == NULL) { - printf("%s: out of memory\n", thisfunc); - return 1; - } + image = malloc(sizeof(*image), M_DEVBUF, M_WAITOK); image->rom_image = rom_image; image->image_size = image_size; image->romt = romt; diff --git a/sys/dev/cardbus/sdhc_cardbus.c b/sys/dev/cardbus/sdhc_cardbus.c index 27dc6774236d..69ef06a7d0bc 100644 --- a/sys/dev/cardbus/sdhc_cardbus.c +++ b/sys/dev/cardbus/sdhc_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc_cardbus.c,v 1.5 2012/12/20 14:37:00 jakllsch Exp $ */ +/* $NetBSD: sdhc_cardbus.c,v 1.6 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 2010 NONAKA Kimihiro @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc_cardbus.c,v 1.5 2012/12/20 14:37:00 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc_cardbus.c,v 1.6 2019/11/10 21:16:34 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -137,11 +137,7 @@ sdhc_cardbus_attach(device_t parent, device_t self, void *aux) /* Allocate an array big enough to hold all the possible hosts */ sc->sc.sc_host = malloc(sizeof(struct sdhc_host *) * nslots, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc.sc_host == NULL) { - aprint_error_dev(self, "couldn't alloc memory\n"); - goto err; - } + M_DEVBUF, M_WAITOK | M_ZERO); /* Enable the device. */ csr = Cardbus_conf_read(ct, ca->ca_tag, PCI_COMMAND_STATUS_REG); diff --git a/sys/dev/dec/dzkbd.c b/sys/dev/dec/dzkbd.c index 6f3c6c64fef9..83b4367487ee 100644 --- a/sys/dev/dec/dzkbd.c +++ b/sys/dev/dec/dzkbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: dzkbd.c,v 1.27 2015/01/02 21:32:26 jklos Exp $ */ +/* $NetBSD: dzkbd.c,v 1.28 2019/11/10 21:16:34 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.27 2015/01/02 21:32:26 jklos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dzkbd.c,v 1.28 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -164,7 +164,7 @@ dzkbd_attach(device_t parent, device_t self, void *aux) dzi = &dzkbd_console_internal; } else { dzi = malloc(sizeof(struct dzkbd_internal), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); dzi->dzi_ks.attmt.sendchar = dzkbd_sendchar; dzi->dzi_ks.attmt.cookie = ls; } @@ -305,4 +305,3 @@ dzkbd_input(void *v, int data) return(1); } - diff --git a/sys/dev/gpib/gpib.c b/sys/dev/gpib/gpib.c index 0f32bcab6d04..4541160fdd28 100644 --- a/sys/dev/gpib/gpib.c +++ b/sys/dev/gpib/gpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpib.c,v 1.23 2016/07/11 11:31:50 msaitoh Exp $ */ +/* $NetBSD: gpib.c,v 1.24 2019/11/10 21:16:34 chs Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.23 2016/07/11 11:31:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.24 2019/11/10 21:16:34 chs Exp $"); #include #include @@ -229,12 +229,7 @@ _gpibregister(struct gpib_softc *sc, int slave, gpib_callback_t callback, void *arg, gpib_handle_t *hdl) { - *hdl = malloc(sizeof(struct gpibqueue), M_DEVBUF, M_NOWAIT); - if (*hdl == NULL) { - DPRINTF(DBG_FAIL, ("_gpibregister: can't allocate queue\n")); - return (1); - } - + *hdl = malloc(sizeof(struct gpibqueue), M_DEVBUF, M_WAITOK); (*hdl)->hq_slave = slave; (*hdl)->hq_callback = callback; (*hdl)->hq_softc = arg; diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c index df93b71b60af..8472aa0fd773 100644 --- a/sys/dev/i2o/iop.c +++ b/sys/dev/i2o/iop.c @@ -1,4 +1,4 @@ -/* $NetBSD: iop.c,v 1.89 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: iop.c,v 1.90 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.89 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.90 2019/11/10 21:16:35 chs Exp $"); #include "iop.h" @@ -392,11 +392,7 @@ iop_init(struct iop_softc *sc, const char *intrstr) #endif /* Allocate message wrappers. */ - im = malloc(sizeof(*im) * sc->sc_maxib, M_DEVBUF, M_NOWAIT|M_ZERO); - if (im == NULL) { - aprint_error_dev(sc->sc_dev, "memory allocation failure\n"); - goto bail_out; - } + im = malloc(sizeof(*im) * sc->sc_maxib, M_DEVBUF, M_WAITOK|M_ZERO); state++; sc->sc_ims = im; SLIST_INIT(&sc->sc_im_freelist); @@ -515,8 +511,7 @@ iop_config_interrupts(device_t self) i = sizeof(struct i2o_systab_entry) * (niop - 1) + sizeof(struct i2o_systab); iop_systab_size = i; - iop_systab = malloc(i, M_DEVBUF, M_NOWAIT|M_ZERO); - + iop_systab = malloc(i, M_DEVBUF, M_WAITOK|M_ZERO); iop_systab->numentries = niop; iop_systab->version = I2O_VERSION_11; @@ -715,7 +710,7 @@ iop_reconfigure(struct iop_softc *sc, u_int chgind) if (sc->sc_tidmap != NULL) free(sc->sc_tidmap, M_DEVBUF); sc->sc_tidmap = malloc(sc->sc_nlctent * sizeof(struct iop_tidmap), - M_DEVBUF, M_NOWAIT|M_ZERO); + M_DEVBUF, M_WAITOK|M_ZERO); /* Allow 1 queued command per device while we're configuring. */ iop_adjqparam(sc, 1); @@ -1107,8 +1102,7 @@ iop_hrt_get(struct iop_softc *sc) size = sizeof(struct i2o_hrt) + (le16toh(hrthdr.numentries) - 1) * sizeof(struct i2o_hrt_entry); - hrt = (struct i2o_hrt *)malloc(size, M_DEVBUF, M_NOWAIT); - + hrt = malloc(size, M_DEVBUF, M_WAITOK); if ((rv = iop_hrt_get0(sc, hrt, size)) != 0) { free(hrt, M_DEVBUF); return (rv); @@ -1170,10 +1164,7 @@ iop_lct_get(struct iop_softc *sc) struct i2o_lct *lct; esize = le32toh(sc->sc_status.expectedlctsize); - lct = (struct i2o_lct *)malloc(esize, M_DEVBUF, M_WAITOK); - if (lct == NULL) - return (ENOMEM); - + lct = malloc(esize, M_DEVBUF, M_WAITOK); if ((rv = iop_lct_get0(sc, lct, esize, 0)) != 0) { free(lct, M_DEVBUF); return (rv); @@ -1182,10 +1173,7 @@ iop_lct_get(struct iop_softc *sc) size = le16toh(lct->tablesize) << 2; if (esize != size) { free(lct, M_DEVBUF); - lct = (struct i2o_lct *)malloc(size, M_DEVBUF, M_WAITOK); - if (lct == NULL) - return (ENOMEM); - + lct = malloc(size, M_DEVBUF, M_WAITOK); if ((rv = iop_lct_get0(sc, lct, size, 0)) != 0) { free(lct, M_DEVBUF); return (rv); @@ -1252,10 +1240,7 @@ iop_field_get_all(struct iop_softc *sc, int tid, int group, void *buf, u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)]; im = iop_msg_alloc(sc, (ii == NULL ? IM_WAIT : 0) | IM_NOSTATUS); - if ((pgop = malloc(sizeof(*pgop), M_DEVBUF, M_WAITOK)) == NULL) { - iop_msg_free(sc, im); - return (ENOMEM); - } + pgop = malloc(sizeof(*pgop), M_DEVBUF, M_WAITOK); im->im_dvcontext = pgop; mf = (struct i2o_util_params_op *)mb; @@ -1314,11 +1299,7 @@ iop_field_set(struct iop_softc *sc, int tid, int group, void *buf, totsize = sizeof(*pgop) + size; im = iop_msg_alloc(sc, IM_WAIT); - if ((pgop = malloc(totsize, M_DEVBUF, M_WAITOK)) == NULL) { - iop_msg_free(sc, im); - return (ENOMEM); - } - + pgop = malloc(totsize, M_DEVBUF, M_WAITOK); mf = (struct i2o_util_params_op *)mb; mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op); mf->msgfunc = I2O_MSGFUNC(tid, I2O_UTIL_PARAMS_SET); @@ -1402,11 +1383,7 @@ iop_table_add_row(struct iop_softc *sc, int tid, int group, void *buf, totsize = sizeof(*pgop) + sizeof(u_int16_t) * 2 + size; im = iop_msg_alloc(sc, IM_WAIT); - if ((pgop = malloc(totsize, M_DEVBUF, M_WAITOK)) == NULL) { - iop_msg_free(sc, im); - return (ENOMEM); - } - + pgop = malloc(totsize, M_DEVBUF, M_WAITOK); mf = (struct i2o_util_params_op *)mb; mf->msgflags = I2O_MSGFLAGS(i2o_util_params_op); mf->msgfunc = I2O_MSGFUNC(tid, I2O_UTIL_PARAMS_SET); @@ -2586,9 +2563,6 @@ iop_passthrough(struct iop_softc *sc, struct ioppt *pt, struct proc *p) } mf = malloc(sc->sc_framesize, M_DEVBUF, M_WAITOK); - if (mf == NULL) - return (ENOMEM); - if ((rv = copyin(pt->pt_msg, mf, pt->pt_msglen)) != 0) goto bad; diff --git a/sys/dev/i2o/iopsp.c b/sys/dev/i2o/iopsp.c index 5e6a0a5b7c02..7fb44168d3c3 100644 --- a/sys/dev/i2o/iopsp.c +++ b/sys/dev/i2o/iopsp.c @@ -1,4 +1,4 @@ -/* $NetBSD: iopsp.c,v 1.37 2015/08/16 19:22:33 msaitoh Exp $ */ +/* $NetBSD: iopsp.c,v 1.38 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2000, 2001, 2007 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.37 2015/08/16 19:22:33 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.38 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -192,7 +192,7 @@ iopsp_attach(device_t parent, device_t self, void *aux) * purposes only. */ size = sc->sc_channel.chan_ntargets * sizeof(struct iopsp_target); - sc->sc_targetmap = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO); + sc->sc_targetmap = malloc(size, M_DEVBUF, M_WAITOK|M_ZERO); /* Build the two maps, and attach to scsipi. */ if (iopsp_reconfig(self) != 0) { diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index f16907db30fc..790eb250a5e0 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $NetBSD: aac.c,v 1.46 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: aac.c,v 1.47 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.46 2017/10/28 04:53:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.47 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -590,11 +590,7 @@ aac_init(struct aac_softc *sc) } sc->sc_aif_fib = malloc(sizeof(struct aac_fib), M_AACBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_aif_fib == NULL) { - aprint_error_dev(sc->sc_dv, "cannot alloc fib structure\n"); - return (ENOMEM); - } + M_WAITOK | M_ZERO); if ((rv = bus_dmamap_create(sc->sc_dmat, sizeof(*sc->sc_common), 1, sizeof(*sc->sc_common), 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->sc_common_dmamap)) != 0) { @@ -627,12 +623,7 @@ aac_init(struct aac_softc *sc) TAILQ_INIT(&sc->sc_fibmap_tqh); sc->sc_ccbs = malloc(sizeof(struct aac_ccb) * sc->sc_max_fibs, M_AACBUF, - M_NOWAIT | M_ZERO); - if (sc->sc_ccbs == NULL) { - aprint_error_dev(sc->sc_dv, "memory allocation failure getting ccbs\n"); - rv = ENOMEM; - goto bail_out; - } + M_WAITOK | M_ZERO); state++; while (sc->sc_total_fibs < AAC_PREALLOCATE_FIBS(sc)) { if (aac_alloc_commands(sc) != 0) diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c index f8a346e940c0..40515809bb6a 100644 --- a/sys/dev/ic/aic79xx.c +++ b/sys/dev/ic/aic79xx.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic79xx.c,v 1.51 2019/02/04 10:09:31 mrg Exp $ */ +/* $NetBSD: aic79xx.c,v 1.52 2019/11/10 21:16:35 chs Exp $ */ /* * Core routines and tables shareable across OS platforms. @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.51 2019/02/04 10:09:31 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.52 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -2706,9 +2706,7 @@ ahd_alloc_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel) && ahd->enabled_targets[scsi_id] != master_tstate) panic("%s: ahd_alloc_tstate - Target already allocated", ahd_name(ahd)); - tstate = malloc(sizeof(*tstate), M_DEVBUF, M_NOWAIT | M_ZERO); - if (tstate == NULL) - return (NULL); + tstate = malloc(sizeof(*tstate), M_DEVBUF, M_WAITOK | M_ZERO); /* * If we have allocated a master tstate, copy user settings from @@ -6018,11 +6016,7 @@ ahd_init(struct ahd_softc *ahd) ahd->stack_size = ahd_probe_stack_size(ahd); ahd->saved_stack = malloc(ahd->stack_size * sizeof(uint16_t), - M_DEVBUF, M_NOWAIT); - if (ahd->saved_stack == NULL) - return (ENOMEM); - /* Zero the memory */ - memset(ahd->saved_stack, 0, ahd->stack_size * sizeof(uint16_t)); + M_DEVBUF, M_WAITOK | M_ZERO); /* * Verify that the compiler hasn't over-agressively diff --git a/sys/dev/ic/aic79xx_osm.c b/sys/dev/ic/aic79xx_osm.c index f64680efd7e0..63f049bb477b 100644 --- a/sys/dev/ic/aic79xx_osm.c +++ b/sys/dev/ic/aic79xx_osm.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic79xx_osm.c,v 1.33 2016/07/14 04:00:45 msaitoh Exp $ */ +/* $NetBSD: aic79xx_osm.c,v 1.34 2019/11/10 21:16:35 chs Exp $ */ /* * Bus independent NetBSD shim for the aic7xxx based adaptec SCSI controllers @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aic79xx_osm.c,v 1.33 2016/07/14 04:00:45 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aic79xx_osm.c,v 1.34 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -780,12 +780,7 @@ int ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) { ahd->platform_data = malloc(sizeof(struct ahd_platform_data), M_DEVBUF, - M_NOWAIT /*| M_ZERO*/); - if (ahd->platform_data == NULL) - return (ENOMEM); - - memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data)); - + M_WAITOK | M_ZERO); return (0); } diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index 3b0270d2f4e3..473b4b781029 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic7xxx.c,v 1.136 2019/06/04 10:15:22 msaitoh Exp $ */ +/* $NetBSD: aic7xxx.c,v 1.137 2019/11/10 21:16:35 chs Exp $ */ /* * Core routines and tables shareable across OS platforms. @@ -39,7 +39,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: aic7xxx.c,v 1.136 2019/06/04 10:15:22 msaitoh Exp $ + * $Id: aic7xxx.c,v 1.137 2019/11/10 21:16:35 chs Exp $ * * //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $ * @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.136 2019/06/04 10:15:22 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aic7xxx.c,v 1.137 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -1573,9 +1573,7 @@ ahc_alloc_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel) && ahc->enabled_targets[scsi_id] != master_tstate) panic("%s: ahc_alloc_tstate - Target already allocated", ahc_name(ahc)); - tstate = malloc(sizeof(*tstate), M_DEVBUF, M_NOWAIT); - if (tstate == NULL) - return (NULL); + tstate = malloc(sizeof(*tstate), M_DEVBUF, M_WAITOK); /* * If we have allocated a master tstate, copy user settings from @@ -3816,10 +3814,7 @@ ahc_softc_init(struct ahc_softc *ahc) /* XXX The shared scb data stuff should be deprecated */ if (ahc->scb_data == NULL) { ahc->scb_data = malloc(sizeof(*ahc->scb_data), - M_DEVBUF, M_NOWAIT); - if (ahc->scb_data == NULL) - return (ENOMEM); - memset(ahc->scb_data, 0, sizeof(*ahc->scb_data)); + M_DEVBUF, M_WAITOK | M_ZERO); } return (0); @@ -4181,10 +4176,7 @@ ahc_init_scbdata(struct ahc_softc *ahc) /* Allocate SCB resources */ scb_data->scbarray = malloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, - M_DEVBUF, M_NOWAIT); - if (scb_data->scbarray == NULL) - return (ENOMEM); - memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC); + M_DEVBUF, M_WAITOK | M_ZERO); /* Determine the number of hardware SCBs and initialize them */ @@ -6365,9 +6357,7 @@ ahc_loadseq(struct ahc_softc *ahc) if (cs_count != 0) { cs_count *= sizeof(struct cs); - ahc->critical_sections = malloc(cs_count, M_DEVBUF, M_NOWAIT); - if (ahc->critical_sections == NULL) - panic("ahc_loadseq: Could not malloc"); + ahc->critical_sections = malloc(cs_count, M_DEVBUF, M_WAITOK); memcpy(ahc->critical_sections, cs_table, cs_count); } ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE); diff --git a/sys/dev/ic/aic7xxx_osm.c b/sys/dev/ic/aic7xxx_osm.c index 150d40775b7b..205c65ba9eb6 100644 --- a/sys/dev/ic/aic7xxx_osm.c +++ b/sys/dev/ic/aic7xxx_osm.c @@ -1,4 +1,4 @@ -/* $NetBSD: aic7xxx_osm.c,v 1.38 2016/10/30 23:56:05 mlelstv Exp $ */ +/* $NetBSD: aic7xxx_osm.c,v 1.39 2019/11/10 21:16:35 chs Exp $ */ /* * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.38 2016/10/30 23:56:05 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.39 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -1073,9 +1073,7 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) if (sizeof(struct ahc_platform_data) == 0) return 0; ahc->platform_data = malloc(sizeof(struct ahc_platform_data), M_DEVBUF, - M_NOWAIT); - if (ahc->platform_data == NULL) - return (ENOMEM); + M_WAITOK); return (0); } diff --git a/sys/dev/ic/arn5008.c b/sys/dev/ic/arn5008.c index db084c956a45..cb1e40b4b54c 100644 --- a/sys/dev/ic/arn5008.c +++ b/sys/dev/ic/arn5008.c @@ -1,4 +1,4 @@ -/* $NetBSD: arn5008.c,v 1.15 2018/06/26 06:48:00 msaitoh Exp $ */ +/* $NetBSD: arn5008.c,v 1.16 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.15 2018/06/26 06:48:00 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.16 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -313,9 +313,7 @@ ar5008_read_rom(struct athn_softc *sc) } /* Allocate space to store ROM in host memory. */ - sc->sc_eep = malloc(sc->sc_eep_size, M_DEVBUF, M_NOWAIT); - if (sc->sc_eep == NULL) - return ENOMEM; + sc->sc_eep = malloc(sc->sc_eep_size, M_DEVBUF, M_WAITOK); /* Read entire ROM and compute checksum. */ sum = 0; @@ -586,9 +584,7 @@ ar5008_rx_alloc(struct athn_softc *sc) int error, nsegs, i; rxq->bf = malloc(ATHN_NRXBUFS * sizeof(*bf), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (rxq->bf == NULL) - return ENOMEM; + M_WAITOK | M_ZERO); size = ATHN_NRXBUFS * sizeof(struct ar_rx_desc); diff --git a/sys/dev/ic/arn9003.c b/sys/dev/ic/arn9003.c index 1fad354d1542..e2ca37479218 100644 --- a/sys/dev/ic/arn9003.c +++ b/sys/dev/ic/arn9003.c @@ -1,4 +1,4 @@ -/* $NetBSD: arn9003.c,v 1.13 2018/06/26 06:48:00 msaitoh Exp $ */ +/* $NetBSD: arn9003.c,v 1.14 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.13 2018/06/26 06:48:00 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.14 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -457,14 +457,10 @@ ar9003_read_rom(struct athn_softc *sc) size_t len, i, j; /* Allocate space to store ROM in host memory. */ - sc->sc_eep = malloc(sc->sc_eep_size, M_DEVBUF, M_NOWAIT); - if (sc->sc_eep == NULL) - return ENOMEM; + sc->sc_eep = malloc(sc->sc_eep_size, M_DEVBUF, M_WAITOK); /* Allocate temporary buffer to store ROM blocks. */ - buf = malloc(2048, M_DEVBUF, M_NOWAIT); - if (buf == NULL) - return ENOMEM; + buf = malloc(2048, M_DEVBUF, M_WAITOK); /* Restore vendor-specified ROM blocks. */ addr = sc->sc_eep_base; @@ -755,10 +751,7 @@ ar9003_rx_alloc(struct athn_softc *sc, int qid, int count) struct ar_rx_status *ds; int error, i; - rxq->bf = malloc(count * sizeof(*bf), M_DEVBUF, M_NOWAIT | M_ZERO); - if (rxq->bf == NULL) - return ENOMEM; - + rxq->bf = malloc(count * sizeof(*bf), M_DEVBUF, M_WAITOK | M_ZERO); rxq->count = count; for (i = 0; i < rxq->count; i++) { diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 618562c8dace..3cd99c3f1478 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $ */ +/* $NetBSD: ath.c,v 1.128 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.127 2019/05/28 07:41:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.128 2019/11/10 21:16:35 chs Exp $"); #endif /* @@ -2703,12 +2703,7 @@ ath_descdma_setup(struct ath_softc *sc, /* allocate rx buffers */ bsize = sizeof(struct ath_buf) * nbuf; - bf = malloc(bsize, M_ATHDEV, M_NOWAIT | M_ZERO); - if (bf == NULL) { - if_printf(ifp, "malloc of %s buffers failed, size %u\n", - dd->dd_name, bsize); - goto fail4; - } + bf = malloc(bsize, M_ATHDEV, M_WAITOK | M_ZERO); dd->dd_bufptr = bf; STAILQ_INIT(head); @@ -2726,8 +2721,6 @@ ath_descdma_setup(struct ath_softc *sc, STAILQ_INSERT_TAIL(head, bf, bf_list); } return 0; -fail4: - bus_dmamap_unload(dd->dd_dmat, dd->dd_dmamap); fail3: bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap); fail2: @@ -4965,11 +4958,7 @@ ath_getchannels(struct ath_softc *sc, u_int cc, int i, ix, nchan; chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL), - M_TEMP, M_NOWAIT); - if (chans == NULL) { - if_printf(ifp, "unable to allocate channel table\n"); - return ENOMEM; - } + M_TEMP, M_WAITOK); if (!ath_hal_init_channels(ah, chans, IEEE80211_CHAN_MAX, &nchan, NULL, 0, NULL, cc, HAL_MODE_ALL, outdoor, xchanmode)) { @@ -5335,11 +5324,7 @@ ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad) /* * Copy in data. */ - indata = malloc(insize, M_TEMP, M_NOWAIT); - if (indata == NULL) { - error = ENOMEM; - goto bad; - } + indata = malloc(insize, M_TEMP, M_WAITOK); error = copyin(ad->ad_in_data, indata, insize); if (error) goto bad; @@ -5352,11 +5337,7 @@ ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad) * pointer for us to use below in reclaiming the buffer; * may want to be more defensive. */ - outdata = malloc(outsize, M_TEMP, M_NOWAIT); - if (outdata == NULL) { - error = ENOMEM; - goto bad; - } + outdata = malloc(outsize, M_TEMP, M_WAITOK); } if (ath_hal_getdiagstate(ah, id, indata, insize, &outdata, &outsize)) { if (outsize < ad->ad_out_size) diff --git a/sys/dev/ic/athrate-amrr.c b/sys/dev/ic/athrate-amrr.c index 8116d4f8d1a2..8cc3a7ccad77 100644 --- a/sys/dev/ic/athrate-amrr.c +++ b/sys/dev/ic/athrate-amrr.c @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-amrr.c,v 1.12 2012/11/08 20:43:55 dyoung Exp $ */ +/* $NetBSD: athrate-amrr.c,v 1.13 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2004 INRIA @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/amrr/amrr.c,v 1.10 2005/08/09 10:19:43 rwatson Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-amrr.c,v 1.12 2012/11/08 20:43:55 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-amrr.c,v 1.13 2019/11/10 21:16:35 chs Exp $"); #endif /* @@ -499,9 +499,7 @@ ath_rate_attach(struct ath_softc *sc) { struct amrr_softc *asc; - asc = malloc(sizeof(struct amrr_softc), M_DEVBUF, M_NOWAIT|M_ZERO); - if (asc == NULL) - return NULL; + asc = malloc(sizeof(struct amrr_softc), M_DEVBUF, M_WAITOK|M_ZERO); asc->arc.arc_space = sizeof(struct amrr_node); callout_init(&asc->timer, debug_mpsafenet ? CALLOUT_MPSAFE : 0); ath_rate_sysctlattach(sc); diff --git a/sys/dev/ic/athrate-onoe.c b/sys/dev/ic/athrate-onoe.c index b2425ac4786d..ebcd547498e9 100644 --- a/sys/dev/ic/athrate-onoe.c +++ b/sys/dev/ic/athrate-onoe.c @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-onoe.c,v 1.15 2012/11/08 20:43:55 dyoung Exp $ */ +/* $NetBSD: athrate-onoe.c,v 1.16 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/onoe/onoe.c,v 1.10 2005/08/09 10:19:43 rwatson Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-onoe.c,v 1.15 2012/11/08 20:43:55 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-onoe.c,v 1.16 2019/11/10 21:16:35 chs Exp $"); #endif /* @@ -488,9 +488,7 @@ ath_rate_attach(struct ath_softc *sc) { struct onoe_softc *osc; - osc = malloc(sizeof(struct onoe_softc), M_DEVBUF, M_NOWAIT|M_ZERO); - if (osc == NULL) - return NULL; + osc = malloc(sizeof(struct onoe_softc), M_DEVBUF, M_WAITOK|M_ZERO); osc->arc.arc_space = sizeof(struct onoe_node); callout_init(&osc->timer, 0); ath_rate_sysctlattach(sc); diff --git a/sys/dev/ic/athrate-sample.c b/sys/dev/ic/athrate-sample.c index 18de49a3311f..d5a4907f7bfe 100644 --- a/sys/dev/ic/athrate-sample.c +++ b/sys/dev/ic/athrate-sample.c @@ -1,4 +1,4 @@ -/* $NetBSD: athrate-sample.c,v 1.19 2012/11/08 20:43:55 dyoung Exp $ */ +/* $NetBSD: athrate-sample.c,v 1.20 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2005 John Bicket @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.9 2005/07/22 16:50:17 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.19 2012/11/08 20:43:55 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.20 2019/11/10 21:16:35 chs Exp $"); #endif @@ -799,9 +799,7 @@ ath_rate_attach(struct ath_softc *sc) struct sample_softc *osc; DPRINTF(sc, "%s:\n", __func__); - osc = malloc(sizeof(struct sample_softc), M_DEVBUF, M_NOWAIT|M_ZERO); - if (osc == NULL) - return NULL; + osc = malloc(sizeof(struct sample_softc), M_DEVBUF, M_WAITOK|M_ZERO); osc->arc.arc_space = sizeof(struct sample_node); osc->ath_smoothing_rate = 95; /* ewma percentage (out of 100) */ osc->ath_sample_rate = 10; /* send a different bit-rate 1/X packets */ diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 4c4ef8be27ca..75e9d7404bfc 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $NetBSD: atw.c,v 1.168 2019/05/28 07:41:48 msaitoh Exp $ */ +/* $NetBSD: atw.c,v 1.169 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.168 2019/05/28 07:41:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.169 2019/11/10 21:16:35 chs Exp $"); #include @@ -374,14 +374,7 @@ atw_read_srom(struct atw_softc *sc) return -1; } - sc->sc_srom = malloc(sc->sc_sromsz, M_DEVBUF, M_NOWAIT); - - if (sc->sc_srom == NULL) { - aprint_error_dev(sc->sc_dev, "unable to allocate SROM buffer\n"); - return -1; - } - - (void)memset(sc->sc_srom, 0, sc->sc_sromsz); + sc->sc_srom = malloc(sc->sc_sromsz, M_DEVBUF, M_WAITOK | M_ZERO); /* ADM8211 has a single 32-bit register for controlling the * 93cx6 SROM. Bit SRS enables the serial port. There is no diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index be55b475e9c5..bd3fdf80706c 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $NetBSD: cac.c,v 1.60 2019/05/08 05:40:51 cnst Exp $ */ +/* $NetBSD: cac.c,v 1.61 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.60 2019/05/08 05:40:51 cnst Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.61 2019/11/10 21:16:35 chs Exp $"); #if defined(_KERNEL_OPT) #include "bio.h" @@ -693,12 +693,7 @@ cac_create_sensors(struct cac_softc *sc) sc->sc_sme = sysmon_envsys_create(); sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_sensor == NULL) { - aprint_error_dev(sc->sc_dev, "can't allocate envsys_data_t\n"); - return(ENOMEM); - } - + M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < nsensors; i++) { sc->sc_sensor[i].units = ENVSYS_DRIVE; sc->sc_sensor[i].state = ENVSYS_SINVALID; diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index e825dfbc669b..a63b89aec81e 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $NetBSD: ciss.c,v 1.40 2019/05/08 05:40:51 cnst Exp $ */ +/* $NetBSD: ciss.c,v 1.41 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.40 2019/05/08 05:40:51 cnst Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.41 2019/11/10 21:16:35 chs Exp $"); #include "bio.h" @@ -347,13 +347,8 @@ ciss_attach(struct ciss_softc *sc) return -1; } - if (!(sc->sc_lds = malloc(sc->maxunits * sizeof(*sc->sc_lds), - M_DEVBUF, M_NOWAIT))) { - bus_dmamem_free(sc->sc_dmat, sc->cmdseg, 1); - bus_dmamap_destroy(sc->sc_dmat, sc->cmdmap); - return -1; - } - memset(sc->sc_lds, 0, sc->maxunits * sizeof(*sc->sc_lds)); + sc->sc_lds = malloc(sc->maxunits * sizeof(*sc->sc_lds), + M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_flush = CISS_FLUSH_ENABLE; if (!(sc->sc_sh = shutdownhook_establish(ciss_shutdown, sc))) { @@ -998,10 +993,7 @@ ciss_pdscan(struct ciss_softc *sc, int ld) if (!k) return NULL; - ldp = malloc(sizeof(*ldp) + (k-1), M_DEVBUF, M_NOWAIT); - if (!ldp) - return NULL; - + ldp = malloc(sizeof(*ldp) + (k-1), M_DEVBUF, M_WAITOK); memset(&ldp->bling, 0, sizeof(ldp->bling)); ldp->ndrives = k; ldp->xname[0] = 0; @@ -1520,11 +1512,7 @@ ciss_create_sensors(struct ciss_softc *sc) sc->sc_sme = sysmon_envsys_create(); sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_sensor == NULL) { - aprint_error_dev(sc->sc_dev, "can't allocate envsys_data"); - return(ENOMEM); - } + M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < nsensors; i++) { sc->sc_sensor[i].units = ENVSYS_DRIVE; diff --git a/sys/dev/ic/clmpcc.c b/sys/dev/ic/clmpcc.c index 36cbb5494c3d..556fadf23cb2 100644 --- a/sys/dev/ic/clmpcc.c +++ b/sys/dev/ic/clmpcc.c @@ -1,4 +1,4 @@ -/* $NetBSD: clmpcc.c,v 1.53 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: clmpcc.c,v 1.54 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.53 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.54 2019/11/10 21:16:35 chs Exp $"); #include "opt_ddb.h" @@ -303,13 +303,7 @@ clmpcc_attach(struct clmpcc_softc *sc) ch->ch_tty = tp; - ch->ch_ibuf = malloc(clmpcc_ibuf_size * 2, M_DEVBUF, M_NOWAIT); - if ( ch->ch_ibuf == NULL ) { - aprint_error_dev(sc->sc_dev, "(%d): unable to allocate ring buffer\n", - chan); - return; - } - + ch->ch_ibuf = malloc(clmpcc_ibuf_size * 2, M_DEVBUF, M_WAITOK); ch->ch_ibuf_end = &(ch->ch_ibuf[clmpcc_ibuf_size * 2]); ch->ch_ibuf_rd = ch->ch_ibuf_wr = ch->ch_ibuf; diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 6ef09654a6d5..a69bc73ceb70 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.355 2019/01/11 23:10:40 thorpej Exp $ */ +/* $NetBSD: com.c,v 1.356 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.355 2019/01/11 23:10:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.356 2019/11/10 21:16:35 chs Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -659,14 +659,9 @@ fifodone: tp->t_softc = sc; sc->sc_tty = tp; - sc->sc_rbuf = malloc(com_rbuf_size << 1, M_DEVBUF, M_NOWAIT); + sc->sc_rbuf = malloc(com_rbuf_size << 1, M_DEVBUF, M_WAITOK); sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf; sc->sc_rbavail = com_rbuf_size; - if (sc->sc_rbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate ring buffer\n"); - return; - } sc->sc_ebuf = sc->sc_rbuf + (com_rbuf_size << 1); tty_attach(tp); diff --git a/sys/dev/ic/cs4231.c b/sys/dev/ic/cs4231.c index 1b3c4366d103..8035378eeec5 100644 --- a/sys/dev/ic/cs4231.c +++ b/sys/dev/ic/cs4231.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231.c,v 1.31 2019/06/08 08:02:38 isaki Exp $ */ +/* $NetBSD: cs4231.c,v 1.32 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs4231.c,v 1.31 2019/06/08 08:02:38 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231.c,v 1.32 2019/11/10 21:16:35 chs Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -164,11 +164,10 @@ cs4231_common_attach(struct cs4231_softc *sc, device_t self, sc->sc_ad1848.chip_name = "CS4232C"; break; default: - if ((buf = malloc(32, M_TEMP, M_NOWAIT)) != NULL) { - snprintf(buf, 32, "unknown rev: %x/%x", - reg&0xe0, reg&7); - sc->sc_ad1848.chip_name = buf; - } + buf = malloc(32, M_TEMP, M_WAITOK); + snprintf(buf, 32, "unknown rev: %x/%x", + reg&0xe0, reg&7); + sc->sc_ad1848.chip_name = buf; } sc->sc_ad1848.mode = 2; /* put ad1848 driver in `MODE 2' mode */ diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index 32288b14991b..7a00a0a52b49 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $NetBSD: cy.c,v 1.61 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: cy.c,v 1.62 2019/11/10 21:16:35 chs Exp $ */ /* * cy.c @@ -16,7 +16,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.61 2017/10/28 04:53:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.62 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -330,14 +330,7 @@ cyopen(dev_t dev, int flag, int mode, struct lwp *l) * Allocate input ring buffer if we don't already have one */ if (cy->cy_ibuf == NULL) { - cy->cy_ibuf = malloc(CY_IBUF_SIZE, M_DEVBUF, M_NOWAIT); - if (cy->cy_ibuf == NULL) { - aprint_error_dev(sc->sc_dev, - "port %d: can't allocate input buffer\n", - cy->cy_port_num); - splx(s); - return ENOMEM; - } + cy->cy_ibuf = malloc(CY_IBUF_SIZE, M_DEVBUF, M_WAITOK); cy->cy_ibuf_end = cy->cy_ibuf + CY_IBUF_SIZE; } /* mark the ring buffer as empty */ diff --git a/sys/dev/ic/i82586.c b/sys/dev/ic/i82586.c index f7324133b18c..e321d09eb2ee 100644 --- a/sys/dev/ic/i82586.c +++ b/sys/dev/ic/i82586.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82586.c,v 1.86 2019/10/21 08:22:06 msaitoh Exp $ */ +/* $NetBSD: i82586.c,v 1.87 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -137,7 +137,7 @@ Mode of operation: */ #include -__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.86 2019/10/21 08:22:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.87 2019/11/10 21:16:35 chs Exp $"); #include @@ -258,12 +258,7 @@ i82586_attach(struct ie_softc *sc, const char *name, uint8_t *etheraddr, if (padbuf == NULL) { padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF, - M_ZERO | M_NOWAIT); - if (padbuf == NULL) { - aprint_error_dev(sc->sc_dev, - "can't allocate pad buffer\n"); - return; - } + M_ZERO | M_WAITOK); } /* Attach the interface. */ diff --git a/sys/dev/ic/icp.c b/sys/dev/ic/icp.c index 798573f40608..9a21d5944b4f 100644 --- a/sys/dev/ic/icp.c +++ b/sys/dev/ic/icp.c @@ -1,4 +1,4 @@ -/* $NetBSD: icp.c,v 1.32 2019/10/18 04:09:02 msaitoh Exp $ */ +/* $NetBSD: icp.c,v 1.33 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.32 2019/10/18 04:09:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.33 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -178,11 +178,7 @@ icp_init(struct icp_softc *icp, const char *intrstr) /* * Allocate and initialize the command control blocks. */ - ic = malloc(sizeof(*ic) * ICP_NCCBS, M_DEVBUF, M_NOWAIT | M_ZERO); - if ((icp->icp_ccbs = ic) == NULL) { - aprint_error_dev(icp->icp_dv, "malloc() failed\n"); - goto bail_out; - } + ic = malloc(sizeof(*ic) * ICP_NCCBS, M_DEVBUF, M_WAITOK | M_ZERO); state++; for (i = 0; i < ICP_NCCBS; i++, ic++) { diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index b123b6e66650..499b89af4d6b 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $NetBSD: iha.c,v 1.42 2011/05/24 16:38:25 joerg Exp $ */ +/* $NetBSD: iha.c,v 1.43 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2001, 2002 Izumi Tsutsui @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.42 2011/05/24 16:38:25 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.43 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -524,12 +524,7 @@ iha_attach(struct iha_softc *sc) } sc->sc_scb = malloc(sizeof(struct iha_scb) * IHA_MAX_SCB, - M_DEVBUF, M_NOWAIT|M_ZERO); - if (sc->sc_scb == NULL) { - aprint_error_dev(sc->sc_dev, "cannot allocate SCB\n"); - return; - } - + M_DEVBUF, M_WAITOK|M_ZERO); for (i = 0, scb = sc->sc_scb; i < IHA_MAX_SCB; i++, scb++) { scb->scb_tagid = i; scb->sgoffset = IHA_SG_SIZE * i; diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index 0d388e2c4454..34df141d5e42 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $NetBSD: malo.c,v 1.16 2019/09/22 09:03:07 kamil Exp $ */ +/* $NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.16 2019/09/22 09:03:07 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -616,12 +616,7 @@ malo_alloc_rx_ring(struct malo_softc *sc, struct malo_rx_ring *ring, int count) ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct malo_rx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK); /* * Pre-allocate Rx buffers and populate Rx ring. @@ -766,14 +761,8 @@ malo_alloc_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring, ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof(struct malo_tx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); - memset(ring->data, 0, count * sizeof(struct malo_tx_data)); for (i = 0; i < count; i++) { error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, MALO_MAX_SCATTER, MCLBYTES, 0, BUS_DMA_NOWAIT, diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 1b1436a39027..2f06e3c127a6 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfi.c,v 1.61 2019/07/29 12:07:57 gdt Exp $ */ +/* $NetBSD: mfi.c,v 1.62 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */ /* @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.61 2019/07/29 12:07:57 gdt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.62 2019/11/10 21:16:35 chs Exp $"); #include "bio.h" @@ -495,10 +495,7 @@ mfi_allocmem(struct mfi_softc *sc, size_t size) DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %ld\n", DEVNAME(sc), (long)size); - mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_NOWAIT|M_ZERO); - if (mm == NULL) - return NULL; - + mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_WAITOK|M_ZERO); mm->am_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -2530,11 +2527,7 @@ mfi_create_sensors(struct mfi_softc *sc) sc->sc_sme = sysmon_envsys_create(); sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_sensor == NULL) { - aprint_error_dev(sc->sc_dev, "can't allocate envsys_data_t\n"); - return ENOMEM; - } + M_DEVBUF, M_WAITOK | M_ZERO); /* BBU */ sc->sc_sensor[0].units = ENVSYS_INDICATOR; diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c index 7756455ab7f5..517222874602 100644 --- a/sys/dev/ic/mlx.c +++ b/sys/dev/ic/mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: mlx.c,v 1.67 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: mlx.c,v 1.68 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.67 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.68 2019/11/10 21:16:35 chs Exp $"); #if defined(_KERNEL_OPT) #include "ld.h" @@ -316,7 +316,7 @@ mlx_init(struct mlx_softc *mlx, const char *intrstr) /* * Allocate and initialize the CCBs. */ - mc = malloc(sizeof(*mc) * MLX_MAX_QUEUECNT, M_DEVBUF, M_NOWAIT); + mc = malloc(sizeof(*mc) * MLX_MAX_QUEUECNT, M_DEVBUF, M_WAITOK); mlx->mlx_ccbs = mc; for (i = 0; i < MLX_MAX_QUEUECNT; i++, mc++) { diff --git a/sys/dev/ic/mvsata.c b/sys/dev/ic/mvsata.c index 1b5006b46b25..bd9a70d8e09e 100644 --- a/sys/dev/ic/mvsata.c +++ b/sys/dev/ic/mvsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata.c,v 1.48 2019/06/23 06:33:17 tsutsui Exp $ */ +/* $NetBSD: mvsata.c,v 1.49 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.48 2019/06/23 06:33:17 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.49 2019/11/10 21:16:35 chs Exp $"); #include "opt_mvsata.h" @@ -348,12 +348,7 @@ mvsata_attach(struct mvsata_softc *sc, const struct mvsata_product *product, sc->sc_wdc_regs = malloc(sizeof(struct wdc_regs) * product->hc * product->port, - M_DEVBUF, M_NOWAIT); - if (sc->sc_wdc_regs == NULL) { - aprint_error_dev(MVSATA_DEV(sc), - "can't allocate wdc regs memory\n"); - return ENOMEM; - } + M_DEVBUF, M_WAITOK); sc->sc_wdcdev.regs = sc->sc_wdc_regs; for (hc = 0; hc < sc->sc_hc; hc++) { @@ -795,14 +790,7 @@ mvsata_atapi_probe_device(struct atapibus_softc *sc, int target) id->atap_config & ATAPI_CFG_CMD_MASK, id->atap_config & ATAPI_CFG_DRQ_MASK); #endif - periph = scsipi_alloc_periph(M_NOWAIT); - if (periph == NULL) { - aprint_error_dev(atac->atac_dev, - "unable to allocate periph" - " for channel %d drive %d\n", - chp->ch_channel, target); - return; - } + periph = scsipi_alloc_periph(M_WAITOK); periph->periph_dev = NULL; periph->periph_channel = chan; periph->periph_switch = &atapi_probe_periphsw; @@ -3026,13 +3014,7 @@ mvsata_port_init(struct mvsata_hc *mvhc, int port) const int eprd_buf_size = MVSATA_EPRD_MAX_SIZE * MVSATA_EDMAQ_LEN; mvport = malloc(sizeof(struct mvsata_port), M_DEVBUF, - M_ZERO | M_NOWAIT); - if (mvport == NULL) { - aprint_error("%s:%d: can't allocate memory for port %d\n", - device_xname(MVSATA_DEV(sc)), mvhc->hc, port); - return ENOMEM; - } - + M_ZERO | M_WAITOK); mvport->port = port; mvport->port_hc = mvhc; mvport->port_edmamode_negotiated = nodma; diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 1624daefe5ac..8198dd4957a4 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr53c9x.c,v 1.151 2019/02/10 17:13:33 christos Exp $ */ +/* $NetBSD: ncr53c9x.c,v 1.152 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.151 2019/02/10 17:13:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.152 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -219,19 +219,13 @@ ncr53c9x_attach(struct ncr53c9x_softc *sc) * can request a 1 byte DMA transfer. */ if (sc->sc_omess == NULL) - sc->sc_omess = malloc(NCR_MAX_MSG_LEN, M_DEVBUF, M_NOWAIT); + sc->sc_omess = malloc(NCR_MAX_MSG_LEN, M_DEVBUF, M_WAITOK); if (sc->sc_imess == NULL) - sc->sc_imess = malloc(NCR_MAX_MSG_LEN + 1, M_DEVBUF, M_NOWAIT); + sc->sc_imess = malloc(NCR_MAX_MSG_LEN + 1, M_DEVBUF, M_WAITOK); sc->sc_tinfo = malloc(sc->sc_ntarg * sizeof(sc->sc_tinfo[0]), - M_DEVBUF, M_NOWAIT | M_ZERO); - - if (sc->sc_omess == NULL || sc->sc_imess == NULL || - sc->sc_tinfo == NULL) { - aprint_error_dev(sc->sc_dev, "out of memory\n"); - return; - } + M_DEVBUF, M_WAITOK | M_ZERO); /* * Treat NCR53C90 with the 86C01 DMA chip exactly as ESP100 diff --git a/sys/dev/ic/oosiop.c b/sys/dev/ic/oosiop.c index 2c894f2c4ef3..b084e7687310 100644 --- a/sys/dev/ic/oosiop.c +++ b/sys/dev/ic/oosiop.c @@ -1,4 +1,4 @@ -/* $NetBSD: oosiop.c,v 1.15 2014/12/15 11:02:33 skrll Exp $ */ +/* $NetBSD: oosiop.c,v 1.16 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2001 Shuichiro URATA. All rights reserved. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: oosiop.c,v 1.15 2014/12/15 11:02:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: oosiop.c,v 1.16 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -256,12 +256,7 @@ oosiop_alloc_cb(struct oosiop_softc *sc, int ncb) /* * Allocate oosiop_cb. */ - cb = malloc(sizeof(struct oosiop_cb) * ncb, M_DEVBUF, M_NOWAIT|M_ZERO); - if (cb == NULL) { - printf(": failed to allocate cb memory\n"); - err = ENOMEM; - goto fail0; - } + cb = malloc(sizeof(struct oosiop_cb) * ncb, M_DEVBUF, M_WAITOK|M_ZERO); /* * Allocate DMA-safe memory for the oosiop_xfer and map it. @@ -342,7 +337,7 @@ fail3: while (i--) { bus_dmamem_unmap(sc->sc_dmat, xfer_kva, xfersize); fail2: bus_dmamem_free(sc->sc_dmat, &seg, 1); fail1: free(cb, M_DEVBUF); -fail0: KASSERT(err); + KASSERT(err); return err; } diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index 44e6c3ca1a88..cfc10c0f8e33 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $NetBSD: osiop.c,v 1.40 2013/12/16 15:49:25 mrg Exp $ */ +/* $NetBSD: osiop.c,v 1.41 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2001 Izumi Tsutsui. All rights reserved. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.40 2013/12/16 15:49:25 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.41 2019/11/10 21:16:35 chs Exp $"); /* #define OSIOP_DEBUG */ @@ -251,11 +251,7 @@ osiop_attach(struct osiop_softc *sc) } acb = malloc(sizeof(struct osiop_acb) * OSIOP_NACB, - M_DEVBUF, M_NOWAIT|M_ZERO); - if (acb == NULL) { - aprint_error(": can't allocate memory for acb\n"); - return; - } + M_DEVBUF, M_WAITOK|M_ZERO); sc->sc_acb = acb; sc->sc_cfflags = device_cfdata(sc->sc_dev)->cf_flags; sc->sc_nexus = NULL; diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 8d67445cd2c7..6fbb5860539f 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbc.c,v 1.60 2019/05/01 07:23:22 mlelstv Exp $ */ +/* $NetBSD: pckbc.c,v 1.61 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2004 Ben Harris. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.60 2019/05/01 07:23:22 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.61 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -249,11 +249,7 @@ pckbc_attach_slot(struct pckbc_softc *sc, pckbc_slot_t slot) if (t->t_slotdata[slot] == NULL) { sdata = malloc(sizeof(struct pckbc_slotdata), - M_DEVBUF, M_NOWAIT); - if (sdata == NULL) { - aprint_error_dev(sc->sc_dv, "no memory\n"); - return (0); - } + M_DEVBUF, M_WAITOK); t->t_slotdata[slot] = sdata; pckbc_init_slotdata(t->t_slotdata[slot]); alloced++; diff --git a/sys/dev/ic/pdq.c b/sys/dev/ic/pdq.c index 79d137f8464d..b432d2f5afb4 100644 --- a/sys/dev/ic/pdq.c +++ b/sys/dev/ic/pdq.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdq.c,v 1.40 2013/09/15 09:26:39 martin Exp $ */ +/* $NetBSD: pdq.c,v 1.41 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1995,1996 Matt Thomas @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pdq.c,v 1.40 2013/09/15 09:26:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdq.c,v 1.41 2019/11/10 21:16:35 chs Exp $"); #define PDQ_HWSUPPORT /* for pdq.h */ @@ -1584,10 +1584,6 @@ pdq_initialize( PDQ_ASSERT(sizeof(pdq_unsolicited_event_t) == 512); pdq = (pdq_t *) PDQ_OS_MEMALLOC(sizeof(pdq_t)); - if (pdq == NULL) { - PDQ_PRINTF(("malloc(%d) failed\n", sizeof(*pdq))); - return NULL; - } PDQ_OS_MEMZERO(pdq, sizeof(pdq_t)); pdq->pdq_type = type; pdq->pdq_unit = unit; diff --git a/sys/dev/ic/pdqvar.h b/sys/dev/ic/pdqvar.h index 3c2ae8d56aba..38a078b3848a 100644 --- a/sys/dev/ic/pdqvar.h +++ b/sys/dev/ic/pdqvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pdqvar.h,v 1.49 2018/06/26 06:48:00 msaitoh Exp $ */ +/* $NetBSD: pdqvar.h,v 1.50 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas @@ -106,7 +106,7 @@ typedef enum _pdq_state_t pdq_state_t; #if !defined(PDQ_BUS_DMA) #define PDQ_OS_VA_TO_BUSPA(pdq, p) vtophys(p) #endif -#define PDQ_OS_MEMALLOC(n) malloc(n, M_DEVBUF, M_NOWAIT) +#define PDQ_OS_MEMALLOC(n) malloc(n, M_DEVBUF, M_WAITOK) #define PDQ_OS_MEMFREE(p, n) free((void *) p, M_DEVBUF) #ifdef __FreeBSD__ #define PDQ_OS_MEMALLOC_CONTIG(n) vm_page_alloc_contig(n, 0, 0xffffffff, PAGE_SIZE) diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index e0c6ecfd2c90..717e2a9315e2 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $NetBSD: rt2560.c,v 1.36 2018/12/22 14:07:53 maxv Exp $ */ +/* $NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */ /* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/ @@ -24,7 +24,7 @@ * http://www.ralinktech.com/ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.36 2018/12/22 14:07:53 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $"); #include @@ -570,14 +570,8 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring, ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); - memset(ring->data, 0, count * sizeof (struct rt2560_tx_data)); for (i = 0; i < count; i++) { error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, RT2560_MAX_SCATTER, MCLBYTES, 0, BUS_DMA_NOWAIT, @@ -712,17 +706,11 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring, ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); /* * Pre-allocate Rx buffers and populate Rx ring. */ - memset(ring->data, 0, count * sizeof (struct rt2560_rx_data)); for (i = 0; i < count; i++) { desc = &sc->rxq.desc[i]; data = &sc->rxq.data[i]; diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index 631bdd428a5f..96df87c65212 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $NetBSD: rt2661.c,v 1.41 2018/12/22 14:07:53 maxv Exp $ */ +/* $NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */ /* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */ @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.41 2018/12/22 14:07:53 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $"); #include @@ -456,14 +456,8 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring, ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); - memset(ring->data, 0, count * sizeof (struct rt2661_tx_data)); for (i = 0; i < count; i++) { error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, RT2661_MAX_SCATTER, MCLBYTES, 0, BUS_DMA_NOWAIT, @@ -596,17 +590,11 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring, ring->physaddr = ring->map->dm_segs->ds_addr; ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF, - M_NOWAIT); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); /* * Pre-allocate Rx buffers and populate Rx ring. */ - memset(ring->data, 0, count * sizeof (struct rt2661_rx_data)); for (i = 0; i < count; i++) { desc = &sc->rxq.desc[i]; data = &sc->rxq.data[i]; diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 263b99340ee9..c9d2cc07efc0 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtw.c,v 1.133 2019/05/28 07:41:48 msaitoh Exp $ */ +/* $NetBSD: rtw.c,v 1.134 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights * reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.133 2019/05/28 07:41:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.134 2019/11/10 21:16:35 chs Exp $"); #include @@ -958,14 +958,7 @@ rtw_srom_read(struct rtw_regs *regs, uint32_t flags, struct rtw_srom *sr, RTW_WRITE8(regs, RTW_9346CR, ecr); - sr->sr_content = malloc(sr->sr_size, M_DEVBUF, M_NOWAIT); - - if (sr->sr_content == NULL) { - aprint_error_dev(dev, "unable to allocate SROM buffer\n"); - return ENOMEM; - } - - (void)memset(sr->sr_content, 0, sr->sr_size); + sr->sr_content = malloc(sr->sr_size, M_DEVBUF, M_WAITOK | M_ZERO); /* RTL8180 has a single 8-bit register for controlling the * 93cx6 SROM. There is no "ready" bit. The RTL8180 @@ -3894,9 +3887,7 @@ rtw_txsoft_blk_setup(struct rtw_txsoft_blk *tsb, u_int qlen) SIMPLEQ_INIT(&tsb->tsb_freeq); tsb->tsb_ndesc = qlen; tsb->tsb_desc = malloc(qlen * sizeof(*tsb->tsb_desc), M_DEVBUF, - M_NOWAIT); - if (tsb->tsb_desc == NULL) - return ENOMEM; + M_WAITOK); return 0; } diff --git a/sys/dev/ic/rtwphy.c b/sys/dev/ic/rtwphy.c index 75314225682f..cc313b985daf 100644 --- a/sys/dev/ic/rtwphy.c +++ b/sys/dev/ic/rtwphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtwphy.c,v 1.16 2013/11/15 14:52:11 nisimura Exp $ */ +/* $NetBSD: rtwphy.c,v 1.17 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2004, 2005 David Young. All rights reserved. * @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtwphy.c,v 1.16 2013/11/15 14:52:11 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtwphy.c,v 1.17 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -422,10 +422,7 @@ rtw_sa2400_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, int digphy) struct rtw_rf *rf; struct rtw_bbpset *bb; - sa = malloc(sizeof(*sa), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sa == NULL) - return NULL; - + sa = malloc(sizeof(*sa), M_DEVBUF, M_WAITOK | M_ZERO); sa->sa_digphy = digphy; rf = &sa->sa_rf; @@ -594,9 +591,7 @@ rtw_grf5101_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, struct rtw_rf *rf; struct rtw_bbpset *bb; - gr = malloc(sizeof(*gr), M_DEVBUF, M_NOWAIT | M_ZERO); - if (gr == NULL) - return NULL; + gr = malloc(sizeof(*gr), M_DEVBUF, M_WAITOK | M_ZERO); rf = &gr->gr_rf; bus = &gr->gr_bus; @@ -731,10 +726,7 @@ rtw_max2820_create(struct rtw_regs *regs, rtw_rf_write_t rf_write, int is_a) struct rtw_rf *rf; struct rtw_bbpset *bb; - mx = malloc(sizeof(*mx), M_DEVBUF, M_NOWAIT | M_ZERO); - if (mx == NULL) - return NULL; - + mx = malloc(sizeof(*mx), M_DEVBUF, M_WAITOK | M_ZERO); mx->mx_is_a = is_a; rf = &mx->mx_rf; diff --git a/sys/dev/ic/seeq8005.c b/sys/dev/ic/seeq8005.c index 3ee7acca3b4c..9d1a5f887972 100644 --- a/sys/dev/ic/seeq8005.c +++ b/sys/dev/ic/seeq8005.c @@ -1,4 +1,4 @@ -/* $NetBSD: seeq8005.c,v 1.64 2019/05/28 07:41:48 msaitoh Exp $ */ +/* $NetBSD: seeq8005.c,v 1.65 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2000, 2001 Ben Harris @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.64 2019/05/28 07:41:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.65 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -247,11 +247,7 @@ seeq8005_attach(struct seeq8005_softc *sc, const uint8_t *myaddr, int *media, if (padbuf == NULL) { padbuf = malloc(ETHER_MIN_LEN - ETHER_CRC_LEN, M_DEVBUF, - M_ZERO | M_NOWAIT); - if (padbuf == NULL) { - aprint_error_dev(dev, "can't allocate pad buffer\n"); - return; - } + M_ZERO | M_WAITOK); } /* Initialise ifnet structure. */ diff --git a/sys/dev/ic/siisata.c b/sys/dev/ic/siisata.c index d5fff64e56cb..556f8db8787e 100644 --- a/sys/dev/ic/siisata.c +++ b/sys/dev/ic/siisata.c @@ -1,4 +1,4 @@ -/* $NetBSD: siisata.c,v 1.39 2018/11/19 19:52:08 jdolecek Exp $ */ +/* $NetBSD: siisata.c,v 1.40 2019/11/10 21:16:35 chs Exp $ */ /* from ahcisata_core.c */ @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.39 2018/11/19 19:52:08 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.40 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -1668,14 +1668,7 @@ siisata_atapi_probe_device(struct atapibus_softc *sc, int target) id->atap_config & ATAPI_CFG_CMD_MASK, id->atap_config & ATAPI_CFG_DRQ_MASK); #endif - periph = scsipi_alloc_periph(M_NOWAIT); - if (periph == NULL) { - aprint_error_dev(sc->sc_dev, - "%s: unable to allocate periph for " - "port %d drive %d\n", __func__, - chp->ch_channel, target); - return; - } + periph = scsipi_alloc_periph(M_WAITOK); periph->periph_dev = NULL; periph->periph_channel = chan; periph->periph_switch = &atapi_probe_periphsw; diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c index 69bcd6245d5d..63ef7acfd8a4 100644 --- a/sys/dev/ic/sti.c +++ b/sys/dev/ic/sti.c @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.19 2017/06/13 19:13:55 spz Exp $ */ +/* $NetBSD: sti.c,v 1.20 2019/11/10 21:16:35 chs Exp $ */ /* $OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.19 2017/06/13 19:13:55 spz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.20 2019/11/10 21:16:35 chs Exp $"); #include "wsdisplay.h" @@ -155,12 +155,7 @@ sti_attach_common(struct sti_softc *sc, bus_space_tag_t iot, int rc; rom = (struct sti_rom *)malloc(sizeof(*rom), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (rom == NULL) { - aprint_error("cannot allocate rom data\n"); - return ENOMEM; - } - + M_WAITOK | M_ZERO); rom->rom_softc = sc; rc = sti_rom_setup(rom, iot, memt, romh, sc->bases, codebase); if (rc != 0) { @@ -187,12 +182,7 @@ sti_attach_screen(struct sti_softc *sc, int flags) int rc; scr = (struct sti_screen *)malloc(sizeof(*scr), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (scr == NULL) { - aprint_error("cannot allocate screen data\n"); - return NULL; - } - + M_WAITOK | M_ZERO); scr->scr_rom = sc->sc_rom; rc = sti_screen_setup(scr, flags); if (rc != 0) { @@ -515,12 +505,7 @@ sti_screen_setup(struct sti_screen *scr, int flags) if (dd->dd_stimemreq) { scr->scr_ecfg.addr = - malloc(dd->dd_stimemreq, M_DEVBUF, M_NOWAIT); - if (!scr->scr_ecfg.addr) { - aprint_error("cannot allocate %d bytes for STI\n", - dd->dd_stimemreq); - return ENOMEM; - } + malloc(dd->dd_stimemreq, M_DEVBUF, M_WAITOK); } sti_region_setup(scr); @@ -781,9 +766,7 @@ rescan: (fp->last - fp->first + 1) * fp->bpc; if (rom->rom_devtype == STI_DEVTYPE1) size *= 4; - scr->scr_romfont = malloc(size, M_DEVBUF, M_NOWAIT); - if (scr->scr_romfont == NULL) - return ENOMEM; + scr->scr_romfont = malloc(size, M_DEVBUF, M_WAITOK); bus_space_read_region_stream_4(memt, romh, addr, (uint32_t *)scr->scr_romfont, size / 4); diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c index 6e3ea2e58150..1be7df7fe1e5 100644 --- a/sys/dev/ic/tulip.c +++ b/sys/dev/ic/tulip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.199 2019/09/13 07:55:06 msaitoh Exp $ */ +/* $NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.199 2019/09/13 07:55:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $"); #include @@ -2198,7 +2198,7 @@ tlp_read_srom(struct tulip_softc *sc) if (sc->sc_srom_addrbits == 0) return 0; size = TULIP_ROM_SIZE(sc->sc_srom_addrbits); - sc->sc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->sc_srom = malloc(size, M_DEVBUF, M_WAITOK); /* Select the SROM. */ miirom = MIIROM_SR; diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c index 209ed34a9052..f6267b320f8c 100644 --- a/sys/dev/ic/vga.c +++ b/sys/dev/ic/vga.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga.c,v 1.115 2015/03/01 07:05:59 mlelstv Exp $ */ +/* $NetBSD: vga.c,v 1.116 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.115 2015/03/01 07:05:59 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.116 2019/11/10 21:16:35 chs Exp $"); #include "opt_vga.h" /* for WSCONS_SUPPORT_PCVTFONTS */ @@ -360,11 +360,7 @@ egavga_getfont(struct vga_config *vc, struct vgascreen *scr, const char *name, f = &vga_consolefont; else #endif - f = malloc(sizeof(struct egavga_font), M_DEVBUF, M_NOWAIT); - if (!f) { - wsfont_unlock(cookie); - return (0); - } + f = malloc(sizeof(struct egavga_font), M_DEVBUF, M_WAITOK); f->wsfont = wf; f->cookie = cookie; f->slot = -1; /* not yet loaded */ diff --git a/sys/dev/ic/vga_raster.c b/sys/dev/ic/vga_raster.c index 3ea44b6f3691..f0721bfaddff 100644 --- a/sys/dev/ic/vga_raster.c +++ b/sys/dev/ic/vga_raster.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_raster.c,v 1.44 2015/03/01 07:05:59 mlelstv Exp $ */ +/* $NetBSD: vga_raster.c,v 1.45 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2001, 2002 Bang Jun-Young @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.44 2015/03/01 07:05:59 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.45 2019/11/10 21:16:35 chs Exp $"); #include "opt_vga.h" #include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */ @@ -867,12 +867,7 @@ vga_raster_setup_font(struct vga_config *vc, struct vgascreen *scr) if (wsfont_lock(cookie, &wf)) return; - vf = malloc(sizeof(struct vga_raster_font), M_DEVBUF, M_NOWAIT); - if (!vf) { - wsfont_unlock(cookie); - return; - } - + vf = malloc(sizeof(struct vga_raster_font), M_DEVBUF, M_WAITOK); vf->font = wf; scr->encoding = vf->font->encoding; LIST_INSERT_HEAD(&scr->fontset, vf, next); diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index 4b2aad5e8270..4312f9a93710 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: z8530tty.c,v 1.133 2019/07/21 16:10:37 rin Exp $ */ +/* $NetBSD: z8530tty.c,v 1.134 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 @@ -137,7 +137,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.133 2019/07/21 16:10:37 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.134 2019/11/10 21:16:35 chs Exp $"); #include "opt_kgdb.h" #include "opt_ntp.h" @@ -408,12 +408,7 @@ zstty_attach(device_t parent, device_t self, void *aux) tty_attach(tp); zst->zst_tty = tp; - zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_NOWAIT); - if (zst->zst_rbuf == NULL) { - aprint_error_dev(zst->zst_dev, - "unable to allocate ring buffer\n"); - return; - } + zst->zst_rbuf = malloc(zstty_rbuf_size << 1, M_DEVBUF, M_WAITOK); zst->zst_ebuf = zst->zst_rbuf + (zstty_rbuf_size << 1); /* Disable the high water mark. */ zst->zst_r_hiwat = 0; diff --git a/sys/dev/ieee1394/firewire.c b/sys/dev/ieee1394/firewire.c index 767f555ae831..14db77bb12bc 100644 --- a/sys/dev/ieee1394/firewire.c +++ b/sys/dev/ieee1394/firewire.c @@ -1,4 +1,4 @@ -/* $NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $ */ +/* $NetBSD: firewire.c,v 1.50 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.50 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -210,30 +210,12 @@ firewireattach(device_t parent, device_t self, void *aux) if (fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA; - fc->crom_src_buf = - (struct crom_src_buf *)malloc(sizeof(struct crom_src_buf), - M_FW, M_NOWAIT | M_ZERO); - if (fc->crom_src_buf == NULL) { - aprint_error_dev(fc->bdev, "Malloc Failure crom src buff\n"); - return; - } - fc->topology_map = - (struct fw_topology_map *)malloc(sizeof(struct fw_topology_map), - M_FW, M_NOWAIT | M_ZERO); - if (fc->topology_map == NULL) { - aprint_error_dev(fc->dev, "Malloc Failure topology map\n"); - free(fc->crom_src_buf, M_FW); - return; - } - fc->speed_map = - (struct fw_speed_map *)malloc(sizeof(struct fw_speed_map), - M_FW, M_NOWAIT | M_ZERO); - if (fc->speed_map == NULL) { - aprint_error_dev(fc->dev, "Malloc Failure speed map\n"); - free(fc->crom_src_buf, M_FW); - free(fc->topology_map, M_FW); - return; - } + fc->crom_src_buf = malloc(sizeof(struct crom_src_buf), + M_FW, M_WAITOK | M_ZERO); + fc->topology_map =malloc(sizeof(struct fw_topology_map), + M_FW, M_WAITOK | M_ZERO); + fc->speed_map = malloc(sizeof(struct fw_speed_map), + M_FW, M_WAITOK | M_ZERO); mutex_init(&fc->tlabel_lock, MUTEX_DEFAULT, IPL_VM); mutex_init(&fc->fc_mtx, MUTEX_DEFAULT, IPL_VM); @@ -259,11 +241,7 @@ firewireattach(device_t parent, device_t self, void *aux) config_pending_decr(self); } - devlist = malloc(sizeof(struct firewire_dev_list), M_DEVBUF, M_NOWAIT); - if (devlist == NULL) { - aprint_error_dev(self, "device list allocation failed\n"); - return; - } + devlist = malloc(sizeof(struct firewire_dev_list), M_DEVBUF, M_WAITOK); faa.name = "fwip"; faa.fc = fc; @@ -1797,13 +1775,7 @@ fw_explore_node(struct fw_device *dfwdev) mutex_exit(&fc->fc_mtx); if (fwdev == NULL) { /* new device */ - fwdev = - malloc(sizeof(struct fw_device), M_FW, M_NOWAIT | M_ZERO); - if (fwdev == NULL) { - if (firewire_debug) - printf("node%d: no memory\n", node); - return -1; - } + fwdev = malloc(sizeof(struct fw_device), M_FW, M_WAITOK | M_ZERO); fwdev->fc = fc; fwdev->eui = binfo->eui64; fwdev->dst = dfwdev->dst; @@ -1915,9 +1887,8 @@ fw_explore(struct firewire_comm *fc) char nodes[63]; todo = 0; - dfwdev = malloc(sizeof(*dfwdev), M_TEMP, M_NOWAIT); - if (dfwdev == NULL) - return; + dfwdev = malloc(sizeof(*dfwdev), M_TEMP, M_WAITOK); + /* setup dummy fwdev */ dfwdev->fc = fc; dfwdev->speed = 0; @@ -2064,13 +2035,7 @@ fw_attach_dev(struct firewire_comm *fc) switch (fwdev->status) { case FWDEVNEW: devlist = malloc(sizeof(struct firewire_dev_list), - M_DEVBUF, M_NOWAIT); - if (devlist == NULL) { - aprint_error_dev(fc->bdev, - "memory allocation failed\n"); - break; - } - + M_DEVBUF, M_WAITOK); locs[IEEE1394IFCF_EUIHI] = fwdev->eui.hi; locs[IEEE1394IFCF_EUILO] = fwdev->eui.lo; diff --git a/sys/dev/ieee1394/sbp.c b/sys/dev/ieee1394/sbp.c index e1f74752e56a..f89559364127 100644 --- a/sys/dev/ieee1394/sbp.c +++ b/sys/dev/ieee1394/sbp.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbp.c,v 1.38 2019/09/23 06:56:20 maxv Exp $ */ +/* $NetBSD: sbp.c,v 1.39 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.38 2019/09/23 06:56:20 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.39 2019/11/10 21:16:35 chs Exp $"); #include @@ -711,13 +711,7 @@ END_DEBUG if (maxlun != target->num_lun) { newluns = (struct sbp_dev **) realloc(target->luns, sizeof(struct sbp_dev *) * maxlun, - M_SBP, M_NOWAIT | M_ZERO); - - if (newluns == NULL) { - aprint_error_dev(sc->sc_fd.dev, "realloc failed\n"); - newluns = target->luns; - maxlun = target->num_lun; - } + M_SBP, M_WAITOK | M_ZERO); /* * We must zero the extended region for the case @@ -751,12 +745,7 @@ END_DEBUG sdev = target->luns[lun]; if (sdev == NULL) { sdev = malloc(sizeof(struct sbp_dev), - M_SBP, M_NOWAIT | M_ZERO); - if (sdev == NULL) { - aprint_error_dev(sc->sc_fd.dev, - "malloc failed\n"); - goto next; - } + M_SBP, M_WAITOK | M_ZERO); target->luns[lun] = sdev; sdev->lun_id = lun; sdev->target = target; diff --git a/sys/dev/isa/elink.c b/sys/dev/isa/elink.c index 054ca1387543..cd364cf59743 100644 --- a/sys/dev/isa/elink.c +++ b/sys/dev/isa/elink.c @@ -1,4 +1,4 @@ -/* $NetBSD: elink.c,v 1.17 2009/03/14 15:36:18 dsl Exp $ */ +/* $NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.17 2009/03/14 15:36:18 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -85,10 +85,7 @@ elink_reset(bus_space_tag_t iot, bus_space_handle_t ioh, int bus) /* Mark this bus so we don't do it again. */ er = (struct elink_done_reset *)malloc(sizeof(struct elink_done_reset), - M_DEVBUF, M_NOWAIT); - if (er == NULL) - panic("elink_reset: can't allocate state storage"); - + M_DEVBUF, M_WAITOK); er->er_bus = bus; LIST_INSERT_HEAD(&elink_all_resets, er, er_link); diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 219246e443f7..5cf0c2f515cb 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.113 2019/02/03 03:19:27 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.114 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.113 2019/02/03 03:19:27 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.114 2019/11/10 21:16:35 chs Exp $"); #include "opt_ddb.h" @@ -1552,10 +1552,7 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) } fd_formb = malloc(sizeof(struct ne7_fd_formb), - M_TEMP, M_NOWAIT); - if (fd_formb == 0) - return ENOMEM; - + M_TEMP, M_WAITOK); fd_formb->head = form_cmd->head; fd_formb->cyl = form_cmd->cylinder; fd_formb->transfer_rate = fd->sc_type->rate; diff --git a/sys/dev/isa/if_ef.c b/sys/dev/isa/if_ef.c index 0ebe63e61eb8..7981ed774fba 100644 --- a/sys/dev/isa/if_ef.c +++ b/sys/dev/isa/if_ef.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ef.c,v 1.34 2019/04/25 10:08:46 msaitoh Exp $ */ +/* $NetBSD: if_ef.c,v 1.35 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.34 2019/04/25 10:08:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.35 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -346,12 +346,7 @@ ef_match(device_t parent, cfdata_t cf, void *aux) bus_addr_t iobase; /* Mark this bus so we don't probe it again. */ - bus = (struct ef_isabus *) - malloc(sizeof(struct ef_isabus), M_DEVBUF, M_NOWAIT); - if (bus == NULL) - panic("%s: can't allocate state storage for %s", - __func__, device_xname(parent)); - + bus = malloc(sizeof(struct ef_isabus), M_DEVBUF, M_WAITOK); bus->bus_state = 0; /* Nothing done yet */ bus->isa_bus = parent; @@ -664,4 +659,3 @@ ef_port_check(bus_space_tag_t iot, bus_space_handle_t ioh) CFATTACH_DECL_NEW(ef, sizeof(struct ef_softc), ef_match, ef_attach, NULL, NULL); - diff --git a/sys/dev/isa/if_ep_isa.c b/sys/dev/isa/if_ep_isa.c index d2c6ac66744c..d5017807f159 100644 --- a/sys/dev/isa/if_ep_isa.c +++ b/sys/dev/isa/if_ep_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ep_isa.c,v 1.45 2016/07/14 10:19:06 msaitoh Exp $ */ +/* $NetBSD: if_ep_isa.c,v 1.46 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.45 2016/07/14 10:19:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ep_isa.c,v 1.46 2019/11/10 21:16:35 chs Exp $"); #include #include @@ -177,11 +177,7 @@ ep_isa_probe(device_t parent, cfdata_t match, void *aux) /* * Mark this bus so we don't probe it again. */ - er = (struct ep_isa_done_probe *) - malloc(sizeof(struct ep_isa_done_probe), M_DEVBUF, M_NOWAIT); - if (er == NULL) - panic("ep_isa_probe: can't allocate state storage"); - + er = malloc(sizeof(struct ep_isa_done_probe), M_DEVBUF, M_WAITOK); er->er_bus = bus; LIST_INSERT_HEAD(&ep_isa_all_probes, er, er_link); diff --git a/sys/dev/isa/if_trtcm_isa.c b/sys/dev/isa/if_trtcm_isa.c index 47c5fba3d9c6..041dc5be1049 100644 --- a/sys/dev/isa/if_trtcm_isa.c +++ b/sys/dev/isa/if_trtcm_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_trtcm_isa.c,v 1.19 2009/05/12 09:10:15 cegger Exp $ */ +/* $NetBSD: if_trtcm_isa.c,v 1.20 2019/11/10 21:16:35 chs Exp $ */ /* XXXJRT verify doens't change isa_attach_args too early */ @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_trtcm_isa.c,v 1.19 2009/05/12 09:10:15 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_trtcm_isa.c,v 1.20 2019/11/10 21:16:35 chs Exp $"); #undef TRTCMISADEBUG @@ -221,13 +221,7 @@ trtcm_isa_probe(device_t parent, cfdata_t match, void *aux) /* * Mark this bus so we don't probe it again. */ - tcm = (struct tcm_isa_done_probe *) - malloc(sizeof(struct tcm_isa_done_probe), M_DEVBUF, M_NOWAIT); - if (tcm == NULL) { - printf("trtcm_isa_probe: can't allocate state storage"); - return 0; - } - + tcm = malloc(sizeof(struct tcm_isa_done_probe), M_DEVBUF, M_WAITOK); tcm->tcm_bus = bus; LIST_INSERT_HEAD(&tcm_isa_all_probes, tcm, tcm_link); diff --git a/sys/dev/isapnp/isapnp.c b/sys/dev/isapnp/isapnp.c index 5f7114abf8f3..cfca600f3495 100644 --- a/sys/dev/isapnp/isapnp.c +++ b/sys/dev/isapnp/isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: isapnp.c,v 1.59 2009/08/23 15:56:56 jmcneill Exp $ */ +/* $NetBSD: isapnp.c,v 1.60 2019/11/10 21:16:35 chs Exp $ */ /*- * Copyright (c) 1996, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.59 2009/08/23 15:56:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.60 2019/11/10 21:16:35 chs Exp $"); #include "isadma.h" @@ -862,10 +862,7 @@ isapnp_match(device_t parent, cfdata_t match, void *aux) if (ipc->ipc_parent == parent) return (0); - ipc = malloc(sizeof(*ipc), M_DEVBUF, M_NOWAIT); - if (ipc == NULL) - panic("isapnp_match: can't allocate probe cookie"); - + ipc = malloc(sizeof(*ipc), M_DEVBUF, M_WAITOK); ipc->ipc_parent = parent; LIST_INSERT_HEAD(&isapnp_probes, ipc, ipc_link); diff --git a/sys/dev/marvell/mvpex.c b/sys/dev/marvell/mvpex.c index 03877f69e802..97a1bad49c99 100644 --- a/sys/dev/marvell/mvpex.c +++ b/sys/dev/marvell/mvpex.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.17 2018/11/16 15:06:23 jmcneill Exp $ */ +/* $NetBSD: mvpex.c,v 1.18 2019/11/10 21:16:35 chs Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.17 2018/11/16 15:06:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.18 2019/11/10 21:16:35 chs Exp $"); #include "opt_pci.h" #include "pci.h" @@ -671,10 +671,7 @@ mvpex_intr_establish(void *v, pci_intr_handle_t pin, int ipl, KASSERT(pin == intrtab->intr_pin); - pexih = malloc(sizeof(*pexih), M_DEVBUF, M_NOWAIT); - if (pexih == NULL) - return NULL; - + pexih = malloc(sizeof(*pexih), M_DEVBUF, M_WAITOK); pexih->ih_func = intrhand; pexih->ih_arg = intrarg; pexih->ih_type = ipl; diff --git a/sys/dev/mvme/mvmebus.c b/sys/dev/mvme/mvmebus.c index b1f33476892f..f8f72bd0f9ac 100644 --- a/sys/dev/mvme/mvmebus.c +++ b/sys/dev/mvme/mvmebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvmebus.c,v 1.20 2018/09/03 16:29:32 riastradh Exp $ */ +/* $NetBSD: mvmebus.c,v 1.21 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.20 2018/09/03 16:29:32 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.21 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -275,10 +275,7 @@ mvmebus_map(void *vsc, vme_addr_t vmeaddr, vme_size_t len, vme_am_t am, vme_data return (rv); /* Allocate space for the resource tag */ - if ((mr = malloc(sizeof(*mr), M_DEVBUF, M_NOWAIT)) == NULL) { - bus_space_unmap(sc->sc_bust, *handle, len); - return (ENOMEM); - } + mr = malloc(sizeof(*mr), M_DEVBUF, M_WAITOK); /* Record the range's details */ mr->mr_am = am; diff --git a/sys/dev/mvme/vme_two_isr.c b/sys/dev/mvme/vme_two_isr.c index 1b2f1f6338ad..d4899918c257 100644 --- a/sys/dev/mvme/vme_two_isr.c +++ b/sys/dev/mvme/vme_two_isr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_two_isr.c,v 1.16 2012/10/27 17:18:27 chs Exp $ */ +/* $NetBSD: vme_two_isr.c,v 1.17 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme_two_isr.c,v 1.16 2012/10/27 17:18:27 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_two_isr.c,v 1.17 2019/11/10 21:16:36 chs Exp $"); #include "vmetwo.h" @@ -135,9 +135,7 @@ vmetwo_probe(bus_space_tag_t bt, bus_addr_t offset) */ struct vmetwo_softc *sc; - /* XXX Should check sc != NULL here... */ - sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); - + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK); sc->sc_mvmebus.sc_bust = bt; sc->sc_lcrh = bh; vmetwo_intr_init(sc); diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 68d21ed76d95..385591f20ceb 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp.c,v 1.86 2019/10/15 16:59:15 msaitoh Exp $ */ +/* $NetBSD: agp.c,v 1.87 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -65,7 +65,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.86 2019/10/15 16:59:15 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.87 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -408,9 +408,7 @@ agp_alloc_gatt(struct agp_softc *sc) void *virtual; int dummyseg; - gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_NOWAIT); - if (!gatt) - return NULL; + gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_WAITOK); gatt->ag_entries = entries; if (agp_alloc_dmamem(sc->as_dmat, entries * sizeof(u_int32_t), diff --git a/sys/dev/pci/agp_ali.c b/sys/dev/pci/agp_ali.c index 8480f855c38c..2b0142ac0bdb 100644 --- a/sys/dev/pci/agp_ali.c +++ b/sys/dev/pci/agp_ali.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_ali.c,v 1.16 2010/11/13 13:52:04 uebayasi Exp $ */ +/* $NetBSD: agp_ali.c,v 1.17 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_ali.c,v 1.16 2010/11/13 13:52:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_ali.c,v 1.17 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -81,11 +81,7 @@ agp_ali_attach(device_t parent, device_t self, void *aux) struct agp_gatt *gatt; pcireg_t reg; - asc = malloc(sizeof *asc, M_AGP, M_NOWAIT); - if (asc == NULL) { - aprint_error(": failed to allocate softc\n"); - return ENOMEM; - } + asc = malloc(sizeof *asc, M_AGP, M_WAITOK); sc->as_chipc = asc; sc->as_methods = &agp_ali_methods; diff --git a/sys/dev/pci/agp_amd.c b/sys/dev/pci/agp_amd.c index cf68e1c474fb..cc0e48bf2da6 100644 --- a/sys/dev/pci/agp_amd.c +++ b/sys/dev/pci/agp_amd.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_amd.c,v 1.21 2010/11/13 13:52:04 uebayasi Exp $ */ +/* $NetBSD: agp_amd.c,v 1.22 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_amd.c,v 1.21 2010/11/13 13:52:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_amd.c,v 1.22 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -101,9 +101,7 @@ agp_amd_alloc_gatt(struct agp_softc *sc) int i, npages; void *vdir; - gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_NOWAIT); - if (!gatt) - return 0; + gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_WAITOK); if (agp_alloc_dmamem(sc->as_dmat, AGP_PAGE_SIZE + entries * sizeof(u_int32_t), 0, @@ -175,12 +173,7 @@ agp_amd_attach(device_t parent, device_t self, void *aux) pcireg_t reg; int error; - asc = malloc(sizeof *asc, M_AGP, M_NOWAIT|M_ZERO); - if (asc == NULL) { - aprint_error(": can't allocate softc\n"); - /* agp_generic_detach(sc) */ - return ENOMEM; - } + asc = malloc(sizeof *asc, M_AGP, M_WAITOK|M_ZERO); error = pci_mapreg_map(pa, AGP_AMD751_REGISTERS, PCI_MAPREG_TYPE_MEM, 0, &asc->iot, &asc->ioh, NULL, NULL); diff --git a/sys/dev/pci/agp_amd64.c b/sys/dev/pci/agp_amd64.c index 3732ffca6cd9..78fefbfa9fb5 100644 --- a/sys/dev/pci/agp_amd64.c +++ b/sys/dev/pci/agp_amd64.c @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_amd64.c,v 1.8 2015/04/04 15:08:40 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_amd64.c,v 1.9 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -208,12 +208,7 @@ agp_amd64_attach(device_t parent, device_t self, void *aux) int maxdevs, i, n; int error; - asc = malloc(sizeof(struct agp_amd64_softc), M_AGP, M_NOWAIT | M_ZERO); - if (asc == NULL) { - aprint_error(": can't allocate softc\n"); - error = ENOMEM; - goto fail0; - } + asc = malloc(sizeof(struct agp_amd64_softc), M_AGP, M_WAITOK | M_ZERO); if (agp_map_aperture(pa, sc, AGP_APBASE) != 0) { aprint_error(": can't map aperture\n"); @@ -321,7 +316,7 @@ agp_amd64_attach(device_t parent, device_t self, void *aux) fail2: agp_free_gatt(sc, gatt); fail1: free(asc, M_AGP); -fail0: agp_generic_detach(sc); + agp_generic_detach(sc); KASSERT(error); return error; } diff --git a/sys/dev/pci/agp_apple.c b/sys/dev/pci/agp_apple.c index 60bc1fd68637..8bc99bed46ac 100644 --- a/sys/dev/pci/agp_apple.c +++ b/sys/dev/pci/agp_apple.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_apple.c,v 1.7 2014/11/02 00:05:03 christos Exp $ */ +/* $NetBSD: agp_apple.c,v 1.8 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_apple.c,v 1.7 2014/11/02 00:05:03 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_apple.c,v 1.8 2019/11/10 21:16:36 chs Exp $"); #include #include #include @@ -84,11 +84,7 @@ agp_apple_attach(device_t parent, device_t self, void *aux) struct agp_apple_softc *asc; struct agp_gatt *gatt; - asc = malloc(sizeof *asc, M_AGP, M_NOWAIT|M_ZERO); - if (asc == NULL) { - aprint_error(": can't allocate chipset-specific softc\n"); - return ENOMEM; - } + asc = malloc(sizeof *asc, M_AGP, M_WAITOK|M_ZERO); sc->as_chipc = asc; sc->as_methods = &agp_apple_methods; pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP, &sc->as_capoff, diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c index 2e8914852938..4a6313b8c2eb 100644 --- a/sys/dev/pci/agp_i810.c +++ b/sys/dev/pci/agp_i810.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_i810.c,v 1.123 2018/08/27 00:51:37 riastradh Exp $ */ +/* $NetBSD: agp_i810.c,v 1.124 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.123 2018/08/27 00:51:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.124 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -311,12 +311,7 @@ agp_i810_attach(device_t parent, device_t self, void *aux) bus_size_t mmadr_size, gtt_off; int error; - isc = malloc(sizeof *isc, M_AGP, M_NOWAIT|M_ZERO); - if (isc == NULL) { - aprint_error(": can't allocate chipset-specific softc\n"); - error = ENOMEM; - goto fail0; - } + isc = malloc(sizeof *isc, M_AGP, M_WAITOK|M_ZERO); sc->as_chipc = isc; sc->as_methods = &agp_i810_methods; @@ -651,7 +646,7 @@ fail2: bus_space_unmap(isc->bst, isc->bsh, isc->size); isc->size = 0; fail1: free(isc, M_AGP); sc->as_chipc = NULL; -fail0: agp_generic_detach(sc); + agp_generic_detach(sc); KASSERT(error); return error; } @@ -810,13 +805,7 @@ agp_i810_init(struct agp_softc *sc) /* According to the specs the gatt on the i810 must be 64k */ isc->gtt_size = 64 * 1024; - gatt = malloc(sizeof(*gatt), M_AGP, M_NOWAIT); - if (gatt == NULL) { - aprint_error_dev(sc->as_dev, - "can't malloc GATT record\n"); - error = ENOMEM; - goto fail0; - } + gatt = malloc(sizeof(*gatt), M_AGP, M_WAITOK); gatt->ag_entries = isc->gtt_size / sizeof(uint32_t); error = agp_alloc_dmamem(sc->as_dmat, isc->gtt_size, 0, &gatt->ag_dmamap, &virtual, &gatt->ag_physical, diff --git a/sys/dev/pci/agp_intel.c b/sys/dev/pci/agp_intel.c index 8074c8bd76bd..94099b84007c 100644 --- a/sys/dev/pci/agp_intel.c +++ b/sys/dev/pci/agp_intel.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_intel.c,v 1.38 2019/02/05 11:20:21 mrg Exp $ */ +/* $NetBSD: agp_intel.c,v 1.39 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_intel.c,v 1.38 2019/02/05 11:20:21 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_intel.c,v 1.39 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -113,12 +113,7 @@ agp_intel_attach(device_t parent, device_t self, void *aux) struct agp_gatt *gatt; u_int32_t value; - isc = malloc(sizeof *isc, M_AGP, M_NOWAIT|M_ZERO); - if (isc == NULL) { - aprint_error(": can't allocate chipset-specific softc\n"); - return ENOMEM; - } - + isc = malloc(sizeof *isc, M_AGP, M_WAITOK|M_ZERO); sc->as_methods = &agp_intel_methods; sc->as_chipc = isc; diff --git a/sys/dev/pci/agp_sis.c b/sys/dev/pci/agp_sis.c index ee0c520df781..be04204dca20 100644 --- a/sys/dev/pci/agp_sis.c +++ b/sys/dev/pci/agp_sis.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_sis.c,v 1.14 2010/11/13 13:52:05 uebayasi Exp $ */ +/* $NetBSD: agp_sis.c,v 1.15 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_sis.c,v 1.14 2010/11/13 13:52:05 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_sis.c,v 1.15 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -80,11 +80,7 @@ agp_sis_attach(device_t parent, device_t self, void *aux) struct agp_gatt *gatt; pcireg_t reg; - ssc = malloc(sizeof *ssc, M_AGP, M_NOWAIT); - if (ssc == NULL) { - aprint_error(": can't allocate chipset-specific softc\n"); - return ENOMEM; - } + ssc = malloc(sizeof *ssc, M_AGP, M_WAITOK); sc->as_methods = &agp_sis_methods; sc->as_chipc = ssc; pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP, &sc->as_capoff, diff --git a/sys/dev/pci/agp_via.c b/sys/dev/pci/agp_via.c index 147a14911849..c8019fb880fa 100644 --- a/sys/dev/pci/agp_via.c +++ b/sys/dev/pci/agp_via.c @@ -1,4 +1,4 @@ -/* $NetBSD: agp_via.c,v 1.21 2011/02/19 20:07:02 jmcneill Exp $ */ +/* $NetBSD: agp_via.c,v 1.22 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: agp_via.c,v 1.21 2011/02/19 20:07:02 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp_via.c,v 1.22 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -91,11 +91,7 @@ agp_via_attach(device_t parent, device_t self, void *aux) struct agp_gatt *gatt; pcireg_t agpsel, capval; - asc = malloc(sizeof *asc, M_AGP, M_NOWAIT|M_ZERO); - if (asc == NULL) { - aprint_error(": can't allocate chipset-specific softc\n"); - return ENOMEM; - } + asc = malloc(sizeof *asc, M_AGP, M_WAITOK|M_ZERO); sc->as_chipc = asc; sc->as_methods = &agp_via_methods; pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP, &sc->as_capoff, diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c index 332b3092caa6..31ec32fb0475 100644 --- a/sys/dev/pci/ahc_pci.c +++ b/sys/dev/pci/ahc_pci.c @@ -39,7 +39,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: ahc_pci.c,v 1.73 2018/12/09 11:14:01 jdolecek Exp $ + * $Id: ahc_pci.c,v 1.74 2019/11/10 21:16:36 chs Exp $ * * //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $ * @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.73 2018/12/09 11:14:01 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.74 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -795,14 +795,7 @@ ahc_pci_attach(device_t parent, device_t self, void *aux) aprint_normal(": %s\n", entry->name); /* Keep information about the PCI bus */ - bd = malloc(sizeof (struct ahc_pci_busdata), M_DEVBUF, M_NOWAIT); - if (bd == NULL) { - aprint_error("%s: unable to allocate bus-specific data\n", - ahc_name(ahc)); - return; - } - memset(bd, 0, sizeof(struct ahc_pci_busdata)); - + bd = malloc(sizeof (struct ahc_pci_busdata), M_DEVBUF, M_WAITOK | M_ZERO); bd->pc = pa->pa_pc; bd->tag = pa->pa_tag; bd->func = pa->pa_function; @@ -1023,11 +1016,7 @@ ahc_pci_attach(device_t parent, device_t self, void *aux) } ahc->seep_config = malloc(sizeof(*ahc->seep_config), - M_DEVBUF, M_NOWAIT); - if (ahc->seep_config == NULL) - goto error_out; - - memset(ahc->seep_config, 0, sizeof(*ahc->seep_config)); + M_DEVBUF, M_WAITOK | M_ZERO); /* See if we have a SEEPROM and perform auto-term */ ahc_check_extport(ahc, &sxfrctl1); diff --git a/sys/dev/pci/ahd_pci.c b/sys/dev/pci/ahd_pci.c index f1d1feb125a5..200a85a9c998 100644 --- a/sys/dev/pci/ahd_pci.c +++ b/sys/dev/pci/ahd_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahd_pci.c,v 1.38 2018/12/09 11:14:01 jdolecek Exp $ */ +/* $NetBSD: ahd_pci.c,v 1.39 2019/11/10 21:16:36 chs Exp $ */ /* * Product specific probe and attach routines for: @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.38 2018/12/09 11:14:01 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.39 2019/11/10 21:16:36 chs Exp $"); #define AHD_PCI_IOADDR PCI_MAPREG_START /* I/O Address */ #define AHD_PCI_MEMADDR (PCI_MAPREG_START + 4) /* Mem I/O Address */ @@ -337,13 +337,7 @@ ahd_pci_attach(device_t parent, device_t self, void *aux) return; /* Keep information about the PCI bus */ - bd = malloc(sizeof (struct ahd_pci_busdata), M_DEVBUF, M_NOWAIT|M_ZERO); - if (bd == NULL) { - aprint_error("%s: unable to allocate bus-specific data\n", - ahd_name(ahd)); - return; - } - + bd = malloc(sizeof (struct ahd_pci_busdata), M_DEVBUF, M_WAITOK|M_ZERO); bd->pc = pa->pa_pc; bd->tag = pa->pa_tag; bd->func = pa->pa_function; @@ -354,11 +348,7 @@ ahd_pci_attach(device_t parent, device_t self, void *aux) ahd->description = entry->name; ahd->seep_config = malloc(sizeof(*ahd->seep_config), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (ahd->seep_config == NULL) { - aprint_error("%s: cannot malloc seep_config!\n", ahd_name(ahd)); - return; - } + M_DEVBUF, M_WAITOK|M_ZERO); LIST_INIT(&ahd->pending_scbs); ahd_timer_init(&ahd->reset_timer); diff --git a/sys/dev/pci/amr.c b/sys/dev/pci/amr.c index b92770a1b131..6c1b9896088d 100644 --- a/sys/dev/pci/amr.c +++ b/sys/dev/pci/amr.c @@ -1,4 +1,4 @@ -/* $NetBSD: amr.c,v 1.64 2018/12/09 11:14:01 jdolecek Exp $ */ +/* $NetBSD: amr.c,v 1.65 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.64 2018/12/09 11:14:01 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.65 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -412,7 +412,7 @@ amr_attach(device_t parent, device_t self, void *aux) /* * Allocate and initalise the command control blocks. */ - ac = malloc(sizeof(*ac) * AMR_MAX_CMDS, M_DEVBUF, M_NOWAIT | M_ZERO); + ac = malloc(sizeof(*ac) * AMR_MAX_CMDS, M_DEVBUF, M_WAITOK | M_ZERO); amr->amr_ccbs = ac; SLIST_INIT(&amr->amr_ccb_freelist); TAILQ_INIT(&amr->amr_ccb_active); @@ -464,7 +464,7 @@ amr_attach(device_t parent, device_t self, void *aux) /* * Retrieve parameters, and tell the world about us. */ - amr->amr_enqbuf = malloc(AMR_ENQUIRY_BUFSIZE, M_DEVBUF, M_NOWAIT); + amr->amr_enqbuf = malloc(AMR_ENQUIRY_BUFSIZE, M_DEVBUF, M_WAITOK); amr->amr_flags |= AMRF_ENQBUF; amr->amr_maxqueuecnt = i; aprint_normal(": AMI RAID "); @@ -1583,4 +1583,3 @@ amr_modcmd(modcmd_t cmd, void *opaque) return error; } - diff --git a/sys/dev/pci/btvmei.c b/sys/dev/pci/btvmei.c index 1b733afc3dba..020212d3e236 100644 --- a/sys/dev/pci/btvmei.c +++ b/sys/dev/pci/btvmei.c @@ -1,4 +1,4 @@ -/* $NetBSD: btvmei.c,v 1.31 2018/12/09 11:14:01 jdolecek Exp $ */ +/* $NetBSD: btvmei.c,v 1.32 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1999 @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: btvmei.c,v 1.31 2018/12/09 11:14:01 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btvmei.c,v 1.32 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -447,7 +447,7 @@ b3_617_map_vme(void *vsc, vme_addr_t vmeaddr, vme_size_t len, vme_am_t am, vme_d /* * save all data needed for later unmapping */ - r = malloc(sizeof(*r), M_DEVBUF, M_NOWAIT); /* XXX check! */ + r = malloc(sizeof(*r), M_DEVBUF, M_WAITOK); r->handle = *handle; r->len = len; r->firstpage = first; @@ -552,10 +552,7 @@ b3_617_establish_vmeint(void *vsc, vme_intr_handle_t handle, int prior, int (*fu long lv; int s; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("b3_617_map_vmeint: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); lv = (long)handle; /* XXX */ diff --git a/sys/dev/pci/btvmeii.c b/sys/dev/pci/btvmeii.c index a0e892b2c32c..9c35091199fa 100644 --- a/sys/dev/pci/btvmeii.c +++ b/sys/dev/pci/btvmeii.c @@ -1,4 +1,4 @@ -/* $NetBSD: btvmeii.c,v 1.23 2019/03/01 09:26:00 msaitoh Exp $ */ +/* $NetBSD: btvmeii.c,v 1.24 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1999 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.23 2019/03/01 09:26:00 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.24 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -433,10 +433,7 @@ b3_2706_establish_vmeint(void *vsc, vme_intr_handle_t handle, int prior, int (*f long lv; int s; - /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("b3_2706_map_vmeint: can't malloc handler info"); + ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); lv = (long)handle; /* XXX */ diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 800885b1a3bb..3cf2ea309708 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bge.c,v 1.338 2019/09/23 07:47:45 maxv Exp $ */ +/* $NetBSD: if_bge.c,v 1.339 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.338 2019/09/23 07:47:45 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.339 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -1359,13 +1359,7 @@ bge_alloc_jumbo_mem(struct bge_softc *sc) sc->bge_cdata.bge_jslots[i] = ptr; ptr += BGE_JLEN; entry = malloc(sizeof(struct bge_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - aprint_error_dev(sc->bge_dev, - "no memory for jumbo buffer queue!\n"); - error = ENOBUFS; - goto out; - } + M_DEVBUF, M_WAITOK); entry->slot = i; SLIST_INSERT_HEAD(&sc->bge_jfree_listhead, entry, jpool_entries); diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 95281cc68dc7..66a783911f7c 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bnx.c,v 1.87 2019/07/26 05:53:30 msaitoh Exp $ */ +/* $NetBSD: if_bnx.c,v 1.88 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $ */ /*- @@ -35,7 +35,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.87 2019/07/26 05:53:30 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.88 2019/11/10 21:16:36 chs Exp $"); /* * The following controllers are supported by this driver: @@ -589,14 +589,9 @@ bnx_attach(device_t parent, device_t self, void *aux) int i, j; if (bnx_tx_pool == NULL) { - bnx_tx_pool = malloc(sizeof(*bnx_tx_pool), M_DEVBUF, M_NOWAIT); - if (bnx_tx_pool != NULL) { - pool_init(bnx_tx_pool, sizeof(struct bnx_pkt), - 0, 0, 0, "bnxpkts", NULL, IPL_NET); - } else { - aprint_error(": can't alloc bnx_tx_pool\n"); - return; - } + bnx_tx_pool = malloc(sizeof(*bnx_tx_pool), M_DEVBUF, M_WAITOK); + pool_init(bnx_tx_pool, sizeof(struct bnx_pkt), + 0, 0, 0, "bnxpkts", NULL, IPL_NET); } bp = bnx_lookup(pa); diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index fd1af87fbb98..c6345060f6ba 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $ */ +/* $NetBSD: if_de.c,v 1.164 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -37,7 +37,7 @@ * board which support 21040, 21041, or 21140 (mostly). */ #include -__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.163 2019/05/29 10:07:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.164 2019/11/10 21:16:36 chs Exp $"); #define TULIP_HDR_DATA @@ -5196,9 +5196,7 @@ tulip_busdma_init(tulip_softc_t * const sc) } #else if (error == 0) { - sc->tulip_txdescs = (tulip_desc_t *) malloc(TULIP_TXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_NOWAIT); - if (sc->tulip_txdescs == NULL) - error = ENOMEM; + sc->tulip_txdescs = malloc(TULIP_TXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_WAITOK); } #endif #if !defined(TULIP_BUS_DMA_NORX) @@ -5229,9 +5227,7 @@ tulip_busdma_init(tulip_softc_t * const sc) } #else if (error == 0) { - sc->tulip_rxdescs = (tulip_desc_t *) malloc(TULIP_RXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_NOWAIT); - if (sc->tulip_rxdescs == NULL) - error = ENOMEM; + sc->tulip_rxdescs = malloc(TULIP_RXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_WAITOK); } #endif return error; @@ -5644,10 +5640,7 @@ tulip_pci_attach(TULIP_PCI_ATTACH_ARGS) } #if defined(__FreeBSD__) - sc = (tulip_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); - if (sc == NULL) - return; - memset(sc, 0, sizeof(*sc)); /* Zero out the softc*/ + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); #endif PCI_GETBUSDEVINFO(sc); diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c index 290d94c9bd75..cae926b932a4 100644 --- a/sys/dev/pci/if_dge.c +++ b/sys/dev/pci/if_dge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_dge.c,v 1.55 2019/05/29 10:07:29 msaitoh Exp $ */ +/* $NetBSD: if_dge.c,v 1.56 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.55 2019/05/29 10:07:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.56 2019/11/10 21:16:36 chs Exp $"); @@ -518,11 +518,7 @@ dge_alloc_rcvmem(struct dge_softc *sc) * Now divide it up into DGE_BUFFER_SIZE pieces and save the addresses * in an array. */ - if ((entry = malloc(sizeof(*entry) * DGE_NBUFFERS, - M_DEVBUF, M_NOWAIT)) == NULL) { - error = ENOBUFS; - goto out; - } + entry = malloc(sizeof(*entry) * DGE_NBUFFERS, M_DEVBUF, M_WAITOK); sc->sc_entry = entry; for (i = 0; i < DGE_NBUFFERS; i++) { entry[i].rb_slot = i; diff --git a/sys/dev/pci/if_ena.c b/sys/dev/pci/if_ena.c index 7870ba57ee70..03cbc8945468 100644 --- a/sys/dev/pci/if_ena.c +++ b/sys/dev/pci/if_ena.c @@ -31,7 +31,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.17 2019/10/18 04:09:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.18 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -641,15 +641,10 @@ ena_setup_tx_resources(struct ena_adapter *adapter, int qid) #endif size = sizeof(struct ena_tx_buffer) * tx_ring->ring_size; - - tx_ring->tx_buffer_info = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); - if (unlikely(tx_ring->tx_buffer_info == NULL)) - return (ENOMEM); + tx_ring->tx_buffer_info = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); size = sizeof(uint16_t) * tx_ring->ring_size; - tx_ring->free_tx_ids = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); - if (unlikely(tx_ring->free_tx_ids == NULL)) - goto err_buf_info_free; + tx_ring->free_tx_ids = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); /* Req id stack for TX OOO completions */ for (i = 0; i < tx_ring->ring_size; i++) @@ -712,7 +707,6 @@ err_buf_info_unmap: } free(tx_ring->free_tx_ids, M_DEVBUF); tx_ring->free_tx_ids = NULL; -err_buf_info_free: free(tx_ring->tx_buffer_info, M_DEVBUF); tx_ring->tx_buffer_info = NULL; diff --git a/sys/dev/pci/if_fpa.c b/sys/dev/pci/if_fpa.c index 7c8716b0bec5..8c52a8a3e016 100644 --- a/sys/dev/pci/if_fpa.c +++ b/sys/dev/pci/if_fpa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fpa.c,v 1.62 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: if_fpa.c,v 1.63 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 1995, 1996 Matt Thomas @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_fpa.c,v 1.62 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_fpa.c,v 1.63 2019/11/10 21:16:36 chs Exp $"); #ifdef __NetBSD__ #include "opt_inet.h" @@ -199,9 +199,7 @@ pdq_pci_attach( pci_conf_write(config_id, PCI_CFLT, data); } - sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO); - if (sc == NULL) - return; + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); if (!pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs)) { free((void *) sc, M_DEVBUF); diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 48ca69a0bc92..0e07bc27bdef 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwi.c,v 1.111 2019/02/03 03:19:27 mrg Exp $ */ +/* $NetBSD: if_iwi.c,v 1.112 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */ /*- @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.111 2019/02/03 03:19:27 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.112 2019/11/10 21:16:36 chs Exp $"); /*- * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver @@ -626,12 +626,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, memset(ring->desc, 0, IWI_TX_DESC_SIZE * count); ring->data = malloc(count * sizeof (struct iwi_tx_data), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } + M_WAITOK | M_ZERO); ring->count = count; /* @@ -721,13 +716,7 @@ iwi_alloc_rx_ring(struct iwi_softc *sc, struct iwi_rx_ring *ring, int count) ring->cur = 0; ring->data = malloc(count * sizeof (struct iwi_rx_data), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, "could not allocate soft data\n"); - error = ENOMEM; - goto fail; - } - + M_WAITOK | M_ZERO); ring->count = count; /* diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index a5ea4c7f4a09..3134e5d31075 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_msk.c,v 1.92 2019/10/17 05:55:18 msaitoh Exp $ */ +/* $NetBSD: if_msk.c,v 1.93 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */ /* @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.92 2019/10/17 05:55:18 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.93 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -643,13 +643,7 @@ msk_alloc_jumbo_mem(struct sk_if_softc *sc_if) sc_if->sk_cdata.sk_jslots[i] = ptr; ptr += SK_JLEN; entry = malloc(sizeof(struct sk_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - sc_if->sk_cdata.sk_jumbo_buf = NULL; - aprint_error(": no memory for jumbo buffer queue!"); - error = ENOBUFS; - goto out; - } + M_DEVBUF, M_WAITOK); entry->slot = i; LIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, entry, jpool_entries); diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 1f5190a442d6..6b26cbcebea8 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sk.c,v 1.100 2019/06/03 15:49:04 msaitoh Exp $ */ +/* $NetBSD: if_sk.c,v 1.101 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -115,7 +115,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.100 2019/06/03 15:49:04 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.101 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -375,9 +375,7 @@ sk_vpd_read(struct sk_softc *sc) } pos += sizeof(res); - sc->sk_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_NOWAIT); - if (sc->sk_vpd_prodname == NULL) - panic("sk_vpd_read"); + sc->sk_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_WAITOK); for (i = 0; i < res.vr_len; i++) sc->sk_vpd_prodname[i] = sk_vpd_readbyte(sc, i + pos); sc->sk_vpd_prodname[i] = '\0'; @@ -393,9 +391,7 @@ sk_vpd_read(struct sk_softc *sc) } pos += sizeof(res); - sc->sk_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_NOWAIT); - if (sc->sk_vpd_readonly == NULL) - panic("sk_vpd_read"); + sc->sk_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_WAITOK); for (i = 0; i < res.vr_len ; i++) sc->sk_vpd_readonly[i] = sk_vpd_readbyte(sc, i + pos); } @@ -886,13 +882,7 @@ sk_alloc_jumbo_mem(struct sk_if_softc *sc_if) sc_if->sk_cdata.sk_jslots[i] = ptr; ptr += SK_JLEN; entry = malloc(sizeof(struct sk_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - aprint_error_dev(sc->sk_dev, - "no memory for jumbo buffer queue!\n"); - error = ENOBUFS; - goto out; - } + M_DEVBUF, M_WAITOK); entry->slot = i; if (i) LIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, @@ -1378,18 +1368,7 @@ sk_attach(device_t parent, device_t self, void *aux) goto fail; } - entry = malloc(sizeof(*entry), M_DEVBUF, M_NOWAIT); - if (!entry) { - aprint_error_dev(sc_if->sk_dev, - "Can't alloc txmap entry\n"); - bus_dmamap_destroy(sc->sc_dmatag, dmamap); - bus_dmamap_unload(sc->sc_dmatag, sc_if->sk_ring_map); - bus_dmamap_destroy(sc->sc_dmatag, sc_if->sk_ring_map); - bus_dmamem_unmap(sc->sc_dmatag, kva, - sizeof(struct sk_ring_data)); - bus_dmamem_free(sc->sc_dmatag, &seg, rseg); - goto fail; - } + entry = malloc(sizeof(*entry), M_DEVBUF, M_WAITOK); entry->dmamap = dmamap; SIMPLEQ_INSERT_HEAD(&sc_if->sk_txmap_head, entry, link); } diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index d8575cdc8be3..5d459f4439aa 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $ */ +/* $NetBSD: if_ti.c,v 1.113 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.112 2019/07/09 08:46:59 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.113 2019/11/10 21:16:36 chs Exp $"); #include "opt_inet.h" @@ -612,14 +612,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) sc->ti_cdata.ti_jslots[i] = ptr; ptr += TI_JLEN; entry = malloc(sizeof(struct ti_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF); - sc->ti_cdata.ti_jumbo_buf = NULL; - printf("%s: no memory for jumbo " - "buffer queue!\n", device_xname(sc->sc_dev)); - return (ENOBUFS); - } + M_DEVBUF, M_WAITOK); entry->slot = i; SIMPLEQ_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); diff --git a/sys/dev/pci/if_tlp_pci.c b/sys/dev/pci/if_tlp_pci.c index 371cbafece0e..90c7f21fa101 100644 --- a/sys/dev/pci/if_tlp_pci.c +++ b/sys/dev/pci/if_tlp_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlp_pci.c,v 1.126 2019/05/29 06:17:28 msaitoh Exp $ */ +/* $NetBSD: if_tlp_pci.c,v 1.127 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.126 2019/05/29 06:17:28 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tlp_pci.c,v 1.127 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -588,7 +588,7 @@ tlp_pci_attach(device_t parent, device_t self, void *aux) switch (sc->sc_chip) { case TULIP_CHIP_21040: sc->sc_srom_addrbits = 6; - sc->sc_srom = malloc(TULIP_ROM_SIZE(6), M_DEVBUF, M_NOWAIT); + sc->sc_srom = malloc(TULIP_ROM_SIZE(6), M_DEVBUF, M_WAITOK); TULIP_WRITE(sc, CSR_MIIROM, MIIROM_SROMCS); for (i = 0; i < TULIP_ROM_SIZE(6); i++) { for (j = 0; j < 10000; j++) { @@ -604,7 +604,7 @@ tlp_pci_attach(device_t parent, device_t self, void *aux) case TULIP_CHIP_82C169: { sc->sc_srom_addrbits = 2; - sc->sc_srom = malloc(TULIP_ROM_SIZE(2), M_DEVBUF, M_NOWAIT); + sc->sc_srom = malloc(TULIP_ROM_SIZE(2), M_DEVBUF, M_WAITOK); /* * The Lite-On PNIC stores the Ethernet address in @@ -652,7 +652,7 @@ tlp_pci_attach(device_t parent, device_t self, void *aux) sc->sc_srom_addrbits = 6; sc->sc_srom = malloc(TULIP_ROM_SIZE(6), M_DEVBUF, - M_NOWAIT | M_ZERO); + M_WAITOK | M_ZERO); memcpy(sc->sc_srom, enaddr, sizeof(enaddr)); if (tlp_srom_debug) { aprint_normal("SROM CONTENTS:"); diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 56d94695980f..e8d6ff58f116 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_txp.c,v 1.60 2019/10/30 07:26:28 msaitoh Exp $ */ +/* $NetBSD: if_txp.c,v 1.61 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2001 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.60 2019/10/30 07:26:28 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.61 2019/11/10 21:16:36 chs Exp $"); #include "opt_inet.h" @@ -1080,13 +1080,10 @@ txp_alloc_rings(struct txp_softc *sc) boot->br_rxbuf_siz = htole32(RXBUF_ENTRIES * sizeof(struct txp_rxbuf_desc)); sc->sc_rxbufs = (struct txp_rxbuf_desc *)sc->sc_rxbufring_dma.dma_vaddr; for (nb = 0; nb < RXBUF_ENTRIES; nb++) { - sd = (struct txp_swdesc *)malloc(sizeof(struct txp_swdesc), - M_DEVBUF, M_NOWAIT); + sd = malloc(sizeof(struct txp_swdesc), M_DEVBUF, M_WAITOK); /* stash away pointer */ memcpy(__UNVOLATILE(&sc->sc_rxbufs[nb].rb_vaddrlo), &sd, sizeof(sd)); - if (sd == NULL) - break; MGETHDR(sd->sd_mbuf, M_DONTWAIT, MT_DATA); if (sd->sd_mbuf == NULL) { diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index b858da6fc140..55bb85ef13ca 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpi.c,v 1.86 2019/06/24 13:57:30 jakllsch Exp $ */ +/* $NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.86 2019/06/24 13:57:30 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $"); /* * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. @@ -812,12 +812,7 @@ wpi_alloc_tx_ring(struct wpi_softc *sc, struct wpi_tx_ring *ring, int count, } ring->data = malloc(count * sizeof (struct wpi_tx_data), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (ring->data == NULL) { - aprint_error_dev(sc->sc_dev, - "could not allocate tx data slots\n"); - goto fail; - } + M_WAITOK | M_ZERO); for (i = 0; i < count; i++) { struct wpi_tx_data *data = &ring->data[i]; diff --git a/sys/dev/pci/igsfb_pci.c b/sys/dev/pci/igsfb_pci.c index 9ab4f9db5bbb..14a02459b6a8 100644 --- a/sys/dev/pci/igsfb_pci.c +++ b/sys/dev/pci/igsfb_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: igsfb_pci.c,v 1.24 2016/07/14 04:00:46 msaitoh Exp $ */ +/* $NetBSD: igsfb_pci.c,v 1.25 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2002, 2003 Valeriy E. Ushakov @@ -31,7 +31,7 @@ * Integraphics Systems IGA 168x and CyberPro series. */ #include -__KERNEL_RCSID(0, "$NetBSD: igsfb_pci.c,v 1.24 2016/07/14 04:00:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igsfb_pci.c,v 1.25 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -178,9 +178,7 @@ igsfb_pci_attach(device_t parent, device_t self, void *aux) isconsole = 1; } else { sc->sc_dc = malloc(sizeof(struct igsfb_devconfig), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_dc == NULL) - panic("unable to allocate igsfb_devconfig"); + M_DEVBUF, M_WAITOK | M_ZERO); if (igsfb_pci_map_regs(sc->sc_dc, pa->pa_iot, pa->pa_memt, pa->pa_pc, pa->pa_tag, PCI_PRODUCT(pa->pa_id)) != 0) diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index 0e049cb4a306..368b3b7caced 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $NetBSD: ips.c,v 1.1 2017/12/03 14:26:38 jdolecek Exp $ */ +/* $NetBSD: ips.c,v 1.2 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: ips.c,v 1.113 2016/08/14 04:08:03 dlg Exp $ */ /*- @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.1 2017/12/03 14:26:38 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.2 2019/11/10 21:16:36 chs Exp $"); #include "bio.h" @@ -1910,10 +1910,7 @@ ips_ccb_alloc(struct ips_softc *sc, int n) struct ips_ccb *ccb; int i; - if ((ccb = malloc(n * sizeof(*ccb), M_DEVBUF, - M_NOWAIT | M_ZERO)) == NULL) - return (NULL); - + ccb = malloc(n * sizeof(*ccb), M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < n; i++) { ccb[i].c_sc = sc; ccb[i].c_id = i; diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c index 325ee48ceacc..7bd32a8d6fdb 100644 --- a/sys/dev/pci/isp_pci.c +++ b/sys/dev/pci/isp_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: isp_pci.c,v 1.121 2019/10/15 19:29:58 christos Exp $ */ +/* $NetBSD: isp_pci.c,v 1.122 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration * All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.121 2019/10/15 19:29:58 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.122 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -480,7 +480,6 @@ isp_pci_probe(device_t parent, cfdata_t match, void *aux) static void isp_pci_attach(device_t parent, device_t self, void *aux) { - static const char nomem[] = "\n%s: no mem for sdparam table\n"; uint32_t data, rev, linesz = PCI_DFLT_LNSZ; struct pci_attach_args *pa = aux; struct isp_pcisoftc *pcs = device_private(self); @@ -687,20 +686,9 @@ isp_pci_attach(device_t parent, device_t self, void *aux) return; } - isp->isp_param = malloc(mamt, M_DEVBUF, M_NOWAIT); - if (isp->isp_param == NULL) { - aprint_error(nomem, device_xname(self)); - return; - } - memset(isp->isp_param, 0, mamt); + isp->isp_param = malloc(mamt, M_DEVBUF, M_WAITOK | M_ZERO); mamt = sizeof (struct scsipi_channel) * isp->isp_nchan; - isp->isp_osinfo.chan = malloc(mamt, M_DEVBUF, M_NOWAIT); - if (isp->isp_osinfo.chan == NULL) { - free(isp->isp_param, M_DEVBUF); - aprint_error(nomem, device_xname(self)); - return; - } - memset(isp->isp_osinfo.chan, 0, mamt); + isp->isp_osinfo.chan = malloc(mamt, M_DEVBUF, M_WAITOK | M_ZERO); isp->isp_osinfo.adapter.adapt_nchannels = isp->isp_nchan; /* diff --git a/sys/dev/pci/ixgbe/ix_txrx.c b/sys/dev/pci/ixgbe/ix_txrx.c index 94495d51b5d2..01e507ffc196 100644 --- a/sys/dev/pci/ixgbe/ix_txrx.c +++ b/sys/dev/pci/ixgbe/ix_txrx.c @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.56 2019/10/16 06:36:00 knakahara Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.57 2019/11/10 21:16:36 chs Exp $ */ /****************************************************************************** @@ -610,14 +610,8 @@ ixgbe_allocate_transmit_buffers(struct tx_ring *txr) goto fail; } - txr->tx_buffers = - (struct ixgbe_tx_buf *) malloc(sizeof(struct ixgbe_tx_buf) * - adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO); - if (txr->tx_buffers == NULL) { - aprint_error_dev(dev, "Unable to allocate tx_buffer memory\n"); - error = ENOMEM; - goto fail; - } + txr->tx_buffers = malloc(sizeof(struct ixgbe_tx_buf) * + adapter->num_tx_desc, M_DEVBUF, M_WAITOK | M_ZERO); /* Create the descriptor buffer dma maps */ txbuf = txr->tx_buffers; @@ -1415,13 +1409,7 @@ ixgbe_allocate_receive_buffers(struct rx_ring *rxr) int bsize, error; bsize = sizeof(struct ixgbe_rx_buf) * rxr->num_desc; - rxr->rx_buffers = (struct ixgbe_rx_buf *)malloc(bsize, M_DEVBUF, - M_NOWAIT | M_ZERO); - if (rxr->rx_buffers == NULL) { - aprint_error_dev(dev, "Unable to allocate rx_buffer memory\n"); - error = ENOMEM; - goto fail; - } + rxr->rx_buffers = malloc(bsize, M_DEVBUF, M_WAITOK | M_ZERO); error = ixgbe_dma_tag_create( /* parent */ adapter->osdep.dmat, @@ -2229,30 +2217,15 @@ ixgbe_allocate_queues(struct adapter *adapter) /* First, allocate the top level queue structs */ adapter->queues = (struct ix_queue *)malloc(sizeof(struct ix_queue) * - adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO); - if (adapter->queues == NULL) { - aprint_error_dev(dev, "Unable to allocate queue memory\n"); - error = ENOMEM; - goto fail; - } + adapter->num_queues, M_DEVBUF, M_WAITOK | M_ZERO); /* Second, allocate the TX ring struct memory */ - adapter->tx_rings = (struct tx_ring *)malloc(sizeof(struct tx_ring) * - adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO); - if (adapter->tx_rings == NULL) { - aprint_error_dev(dev, "Unable to allocate TX ring memory\n"); - error = ENOMEM; - goto tx_fail; - } + adapter->tx_rings = malloc(sizeof(struct tx_ring) * + adapter->num_queues, M_DEVBUF, M_WAITOK | M_ZERO); /* Third, allocate the RX ring */ adapter->rx_rings = (struct rx_ring *)malloc(sizeof(struct rx_ring) * - adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO); - if (adapter->rx_rings == NULL) { - aprint_error_dev(dev, "Unable to allocate RX ring memory\n"); - error = ENOMEM; - goto rx_fail; - } + adapter->num_queues, M_DEVBUF, M_WAITOK | M_ZERO); /* For the ring itself */ tsize = roundup2(adapter->num_tx_desc * sizeof(union ixgbe_adv_tx_desc), @@ -2372,10 +2345,7 @@ err_tx_desc: for (txr = adapter->tx_rings; txconf > 0; txr++, txconf--) ixgbe_dma_free(adapter, &txr->txdma); free(adapter->rx_rings, M_DEVBUF); -rx_fail: free(adapter->tx_rings, M_DEVBUF); -tx_fail: free(adapter->queues, M_DEVBUF); -fail: return (error); } /* ixgbe_allocate_queues */ diff --git a/sys/dev/pci/ixgbe/ixgbe.c b/sys/dev/pci/ixgbe/ixgbe.c index e9dbd1e09b62..44623428215a 100644 --- a/sys/dev/pci/ixgbe/ixgbe.c +++ b/sys/dev/pci/ixgbe/ixgbe.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.214 2019/10/16 04:07:42 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.215 2019/11/10 21:16:36 chs Exp $ */ /****************************************************************************** @@ -894,12 +894,7 @@ ixgbe_attach(device_t parent, device_t dev, void *aux) /* Allocate multicast array memory. */ adapter->mta = malloc(sizeof(*adapter->mta) * - MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_NOWAIT); - if (adapter->mta == NULL) { - aprint_error_dev(dev, "Cannot allocate multicast setup array\n"); - error = ENOMEM; - goto err_out; - } + MAX_NUM_MULTICAST_ADDRESSES, M_DEVBUF, M_WAITOK); /* Enable WoL (if supported) */ ixgbe_check_wol_support(adapter); diff --git a/sys/dev/pci/jmide.c b/sys/dev/pci/jmide.c index e589b916b64b..7a1f9ff5224b 100644 --- a/sys/dev/pci/jmide.c +++ b/sys/dev/pci/jmide.c @@ -1,4 +1,4 @@ -/* $NetBSD: jmide.c,v 1.22 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: jmide.c,v 1.23 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2007 Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.22 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.23 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -278,11 +278,7 @@ jmide_attach(device_t parent, device_t self, void *aux) return; if (pa->pa_function == 1 && (pcictrl0 & JM_CONTROL0_PCIIDE_F1) == 0) return; - pp = malloc(sizeof(struct pciide_product_desc), M_DEVBUF, M_NOWAIT); - if (pp == NULL) { - aprint_error("%s: can't malloc sc_pp\n", JM_NAME(sc)); - return; - } + pp = malloc(sizeof(struct pciide_product_desc), M_DEVBUF, M_WAITOK); aprint_normal("%s: PCI IDE interface used", JM_NAME(sc)); pp->ide_product = 0; pp->ide_flags = 0; diff --git a/sys/dev/pci/mfii.c b/sys/dev/pci/mfii.c index 1afda5b6d4b1..f3bf989d0b25 100644 --- a/sys/dev/pci/mfii.c +++ b/sys/dev/pci/mfii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfii.c,v 1.4 2019/04/24 09:21:01 bouyer Exp $ */ +/* $NetBSD: mfii.c,v 1.5 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.4 2019/04/24 09:21:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.5 2019/11/10 21:16:36 chs Exp $"); #include "bio.h" @@ -1096,10 +1096,7 @@ mfii_dmamem_alloc(struct mfii_softc *sc, size_t size) struct mfii_dmamem *m; int nsegs; - m = malloc(sizeof(*m), M_DEVBUF, M_NOWAIT | M_ZERO); - if (m == NULL) - return (NULL); - + m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO); m->mdm_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -3785,12 +3782,8 @@ mfii_create_sensors(struct mfii_softc *sc) sc->sc_sme = sysmon_envsys_create(); sc->sc_sensors = malloc(sizeof(envsys_data_t) * nsensors, - M_DEVBUF, M_NOWAIT | M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); - if (sc->sc_sensors == NULL) { - aprint_error_dev(sc->sc_dev, "can't allocate envsys_data_t\n"); - return ENOMEM; - } /* BBU */ sc->sc_sensors[0].units = ENVSYS_INDICATOR; sc->sc_sensors[0].state = ENVSYS_SINVALID; diff --git a/sys/dev/pci/mly.c b/sys/dev/pci/mly.c index 31e9989091f4..a4ca605a91e2 100644 --- a/sys/dev/pci/mly.c +++ b/sys/dev/pci/mly.c @@ -1,4 +1,4 @@ -/* $NetBSD: mly.c,v 1.52 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: mly.c,v 1.53 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.52 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.53 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -1632,7 +1632,7 @@ mly_alloc_ccbs(struct mly_softc *mly) return (rv); mly->mly_ccbs = malloc(sizeof(struct mly_ccb) * mly->mly_ncmds, - M_DEVBUF, M_NOWAIT|M_ZERO); + M_DEVBUF, M_WAITOK|M_ZERO); for (i = 0; i < mly->mly_ncmds; i++) { mc = mly->mly_ccbs + i; diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index a877d7e13019..a0fffc45aedd 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mpii.c,v 1.22 2019/03/11 14:35:22 kardel Exp $ */ +/* $NetBSD: mpii.c,v 1.23 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $ */ /* * Copyright (c) 2010, 2012 Mike Belopuhov @@ -20,7 +20,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.22 2019/03/11 14:35:22 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.23 2019/11/10 21:16:36 chs Exp $"); #include "bio.h" @@ -596,12 +596,7 @@ mpii_attach(device_t parent, device_t self, void *aux) mutex_init(&sc->sc_devs_mtx, MUTEX_DEFAULT, IPL_BIO); sc->sc_devs = malloc(sc->sc_max_devices * sizeof(struct mpii_device *), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_devs == NULL) { - aprint_error_dev(self, - "unable to allocate memory for mpii_device\n"); - goto free_queues; - } + M_DEVBUF, M_WAITOK | M_ZERO); if (mpii_portenable(sc) != 0) { aprint_error_dev(self, "unable to enable port\n"); @@ -1788,12 +1783,7 @@ mpii_event_raid(struct mpii_softc *sc, struct mpii_msg_event_reply *enp) case MPII_EVT_IR_CFG_ELEMENT_RC_ADDED: case MPII_EVT_IR_CFG_ELEMENT_RC_VOLUME_CREATED: dev = malloc(sizeof(*dev), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (!dev) { - printf("%s: failed to allocate a " - "device structure\n", DEVNAME(sc)); - break; - } + M_WAITOK | M_ZERO); mutex_enter(&sc->sc_devs_mtx); if (mpii_find_dev(sc, le16toh(ce->vol_dev_handle))) { @@ -2498,10 +2488,7 @@ mpii_dmamem_alloc(struct mpii_softc *sc, size_t size) struct mpii_dmamem *mdm; int nsegs; - mdm = malloc(sizeof(*mdm), M_DEVBUF, M_NOWAIT | M_ZERO); - if (mdm == NULL) - return (NULL); - + mdm = malloc(sizeof(*mdm), M_DEVBUF, M_WAITOK | M_ZERO); mdm->mdm_size = size; if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, @@ -2634,12 +2621,7 @@ mpii_alloc_ccbs(struct mpii_softc *sc) return 1; sc->sc_ccbs = malloc((sc->sc_max_cmds-1) * sizeof(*ccb), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_ccbs == NULL) { - printf("%s: unable to allocate ccbs\n", DEVNAME(sc)); - return (1); - } - + M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_requests = mpii_dmamem_alloc(sc, sc->sc_request_size * sc->sc_max_cmds); if (sc->sc_requests == NULL) { @@ -2737,9 +2719,7 @@ mpii_alloc_replies(struct mpii_softc *sc) DNPRINTF(MPII_D_MISC, "%s: mpii_alloc_replies\n", DEVNAME(sc)); sc->sc_rcbs = malloc(sc->sc_num_reply_frames * sizeof(struct mpii_rcb), - M_DEVBUF, M_NOWAIT); - if (sc->sc_rcbs == NULL) - return (1); + M_DEVBUF, M_WAITOK); sc->sc_replies = mpii_dmamem_alloc(sc, sc->sc_reply_size * sc->sc_num_reply_frames); @@ -3860,13 +3840,7 @@ mpii_bio_volstate(struct mpii_softc *sc, struct bioc_vol *bv) } pagelen = hdr.page_length * 4; - vpg = malloc(pagelen, M_TEMP, M_NOWAIT | M_ZERO); - if (vpg == NULL) { - DNPRINTF(MPII_D_MISC, "%s: unable to allocate space for raid " - "volume page 0\n", DEVNAME(sc)); - return (ENOMEM); - } - + vpg = malloc(pagelen, M_TEMP, M_WAITOK | M_ZERO); if (mpii_req_cfg_page(sc, MPII_CFG_RAID_VOL_ADDR_HANDLE | volh, MPII_PG_POLL, &hdr, 1, vpg, pagelen) != 0) { DNPRINTF(MPII_D_MISC, "%s: unable to fetch raid volume " @@ -3912,11 +3886,7 @@ mpii_create_sensors(struct mpii_softc *sc) DEVNAME(sc), sc->sc_max_volumes); sc->sc_sme = sysmon_envsys_create(); sc->sc_sensors = malloc(sizeof(envsys_data_t) * sc->sc_max_volumes, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc_sensors == NULL) { - aprint_error_dev(sc->sc_dev, "can't allocate envsys_data_t\n"); - return (1); - } + M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < sc->sc_max_volumes; i++) { sc->sc_sensors[i].units = ENVSYS_DRIVE; diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c index 8b16255c4487..e8b3733d414d 100644 --- a/sys/dev/pci/pccbb.c +++ b/sys/dev/pci/pccbb.c @@ -1,4 +1,4 @@ -/* $NetBSD: pccbb.c,v 1.214 2019/03/01 09:26:00 msaitoh Exp $ */ +/* $NetBSD: pccbb.c,v 1.215 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1998, 1999 and 2000 @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.214 2019/03/01 09:26:00 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.215 2019/11/10 21:16:36 chs Exp $"); /* #define CBB_DEBUG @@ -2938,10 +2938,8 @@ pccbb_winlist_insert(struct pccbb_win_chain_head *head, bus_addr_t start, { struct pccbb_win_chain *chainp, *elem; - if ((elem = malloc(sizeof(struct pccbb_win_chain), M_DEVBUF, - M_NOWAIT)) == NULL) - return 1; /* fail */ - + elem = malloc(sizeof(struct pccbb_win_chain), M_DEVBUF, + M_WAITOK); elem->wc_start = start; elem->wc_end = start + (size - 1); elem->wc_handle = bsh; diff --git a/sys/dev/pci/sdhc_pci.c b/sys/dev/pci/sdhc_pci.c index 50305b747fe9..18a60771ba26 100644 --- a/sys/dev/pci/sdhc_pci.c +++ b/sys/dev/pci/sdhc_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: sdhc_pci.c,v 1.15 2019/09/28 10:47:09 mlelstv Exp $ */ +/* $NetBSD: sdhc_pci.c,v 1.16 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.15 2019/09/28 10:47:09 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.16 2019/11/10 21:16:36 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -283,11 +283,7 @@ sdhc_pci_attach(device_t parent, device_t self, void *aux) /* Allocate an array big enough to hold all the possible hosts */ sc->sc.sc_host = malloc(sizeof(struct sdhc_host *) * nslots, - M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->sc.sc_host == NULL) { - aprint_error_dev(self, "couldn't alloc memory\n"); - goto err; - } + M_DEVBUF, M_WAITOK | M_ZERO); /* Enable the device. */ csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); diff --git a/sys/dev/pci/trm.c b/sys/dev/pci/trm.c index dc5866e3cbd2..75da8b4aa35e 100644 --- a/sys/dev/pci/trm.c +++ b/sys/dev/pci/trm.c @@ -1,4 +1,4 @@ -/* $NetBSD: trm.c,v 1.40 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: trm.c,v 1.41 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2002 Izumi Tsutsui. All rights reserved. * @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.40 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.41 2019/11/10 21:16:36 chs Exp $"); /* #define TRM_DEBUG */ #ifdef TRM_DEBUG @@ -581,12 +581,8 @@ trm_init(struct trm_softc *sc) TAILQ_INIT(&sc->sc_readysrb); sc->sc_srb = malloc(sizeof(struct trm_srb) * TRM_MAX_SRB, - M_DEVBUF, M_NOWAIT|M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); DPRINTF(("all SRB size=%zx\n", sizeof(struct trm_srb) * TRM_MAX_SRB)); - if (sc->sc_srb == NULL) { - aprint_error(": can not allocate SRB\n"); - return 1; - } for (i = 0, srb = sc->sc_srb; i < TRM_MAX_SRB; i++) { srb->sgentry = sc->sc_sglist + TRM_MAX_SG_ENTRIES * i; diff --git a/sys/dev/pci/twa.c b/sys/dev/pci/twa.c index 4de379791874..dfcb9545504b 100644 --- a/sys/dev/pci/twa.c +++ b/sys/dev/pci/twa.c @@ -1,4 +1,4 @@ -/* $NetBSD: twa.c,v 1.57 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: twa.c,v 1.58 2019/11/10 21:16:36 chs Exp $ */ /* $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $ */ /*- @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.57 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.58 2019/11/10 21:16:36 chs Exp $"); //#define TWA_DEBUG @@ -836,13 +836,10 @@ twa_alloc_req_pkts(struct twa_softc *sc, int num_reqs) size_t max_segs, max_xfer; int i, rv, rseg, size; - if ((sc->sc_units = malloc(sc->sc_nunits * - sizeof(struct twa_drive), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) - return(ENOMEM); - - if ((sc->twa_req_buf = malloc(num_reqs * sizeof(struct twa_request), - M_DEVBUF, M_NOWAIT)) == NULL) - return(ENOMEM); + sc->sc_units = malloc(sc->sc_nunits * + sizeof(struct twa_drive), M_DEVBUF, M_WAITOK | M_ZERO); + sc->twa_req_buf = malloc(num_reqs * sizeof(struct twa_request), + M_DEVBUF, M_WAITOK); size = num_reqs * sizeof(struct twa_command_packet); @@ -993,13 +990,8 @@ twa_request_bus_scan(device_t self, const char *attr, const int *flags) tr->tr_cmd_pkt_type |= TWA_CMD_PKT_TYPE_INTERNAL; - tr->tr_data = malloc(TWA_SECTOR_SIZE, M_DEVBUF, M_NOWAIT); + tr->tr_data = malloc(TWA_SECTOR_SIZE, M_DEVBUF, M_WAITOK); - if (tr->tr_data == NULL) { - twa_release_request(tr); - splx(s); - return (ENOMEM); - } td = &sc->sc_units[unit]; if (twa_inquiry(tr, unit) == 0) { diff --git a/sys/dev/pci/twe.c b/sys/dev/pci/twe.c index b3353539a88c..2efd0ef82166 100644 --- a/sys/dev/pci/twe.c +++ b/sys/dev/pci/twe.c @@ -1,4 +1,4 @@ -/* $NetBSD: twe.c,v 1.107 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: twe.c,v 1.108 2019/11/10 21:16:36 chs Exp $ */ /*- * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.107 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.108 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -398,20 +398,16 @@ twe_attach(device_t parent, device_t self, void *aux) return; } - ccb = malloc(sizeof(*ccb) * TWE_MAX_QUEUECNT, M_DEVBUF, M_NOWAIT); - if (ccb == NULL) { - aprint_error_dev(self, "unable to allocate memory for ccbs\n"); - return; - } - sc->sc_cmds_paddr = sc->sc_dmamap->dm_segs[0].ds_addr; memset(sc->sc_cmds, 0, size); - sc->sc_ccbs = ccb; tc = (struct twe_cmd *)sc->sc_cmds; max_segs = twe_get_maxsegs(); max_xfer = twe_get_maxxfer(max_segs); + ccb = malloc(sizeof(*ccb) * TWE_MAX_QUEUECNT, M_DEVBUF, M_WAITOK); + sc->sc_ccbs = ccb; + for (i = 0; i < TWE_MAX_QUEUECNT; i++, tc++, ccb++) { ccb->ccb_cmd = tc; ccb->ccb_cmdid = i; @@ -1195,13 +1191,8 @@ twe_param_set(struct twe_softc *sc, int table_id, int param_id, size_t size, struct twe_param *tp; int rv, s; - tp = malloc(TWE_SECTOR_SIZE, M_DEVBUF, M_NOWAIT); - if (tp == NULL) - return ENOMEM; - + tp = malloc(TWE_SECTOR_SIZE, M_DEVBUF, M_WAITOK); ccb = twe_ccb_alloc_wait(sc, TWE_CCB_DATA_IN | TWE_CCB_DATA_OUT); - KASSERT(ccb != NULL); - ccb->ccb_data = tp; ccb->ccb_datasize = TWE_SECTOR_SIZE; ccb->ccb_tx.tx_handler = 0; diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 4f4312c67769..5b519caf1a49 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $NetBSD: ubsec.c,v 1.46 2018/12/22 14:07:53 maxv Exp $ */ +/* $NetBSD: ubsec.c,v 1.47 2019/11/10 21:16:36 chs Exp $ */ /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ /* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.46 2018/12/22 14:07:53 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.47 2019/11/10 21:16:36 chs Exp $"); #undef UBSEC_DEBUG @@ -437,13 +437,7 @@ ubsec_attach(device_t parent, device_t self, void *aux) for (i = 0; i < UBS_MAX_NQUEUE; i++, dmap++) { struct ubsec_q *q; - q = (struct ubsec_q *)malloc(sizeof(struct ubsec_q), - M_DEVBUF, M_ZERO|M_NOWAIT); - if (q == NULL) { - aprint_error_dev(self, - "can't allocate queue buffers\n"); - break; - } + q = malloc(sizeof(struct ubsec_q), M_DEVBUF, M_ZERO|M_WAITOK); if (ubsec_dma_malloc(sc, sizeof(struct ubsec_dmachunk), &dmap->d_alloc, 0)) { diff --git a/sys/dev/pckbport/pckbport.c b/sys/dev/pckbport/pckbport.c index d12fb3758774..1b74321e305e 100644 --- a/sys/dev/pckbport/pckbport.c +++ b/sys/dev/pckbport/pckbport.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbport.c,v 1.17 2014/01/11 20:29:03 jakllsch Exp $ */ +/* $NetBSD: pckbport.c,v 1.18 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 2004 Ben Harris @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.17 2014/01/11 20:29:03 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.18 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -123,8 +123,7 @@ pckbport_attach(void *cookie, struct pckbport_accessops const *ops) if (cookie == pckbport_cntag.t_cookie && ops == pckbport_cntag.t_ops) return &pckbport_cntag; - t = malloc(sizeof(struct pckbport_tag), M_DEVBUF, M_NOWAIT | M_ZERO); - if (t == NULL) return NULL; + t = malloc(sizeof(struct pckbport_tag), M_DEVBUF, M_WAITOK | M_ZERO); callout_init(&t->t_cleanup, 0); t->t_cookie = cookie; t->t_ops = ops; @@ -146,11 +145,7 @@ pckbport_attach_slot(device_t dev, pckbport_tag_t t, if (t->t_slotdata[slot] == NULL) { sdata = malloc(sizeof(struct pckbport_slotdata), - M_DEVBUF, M_NOWAIT); - if (sdata == NULL) { - aprint_error_dev(dev, "no memory\n"); - return 0; - } + M_DEVBUF, M_WAITOK); t->t_slotdata[slot] = sdata; pckbport_init_slotdata(t->t_slotdata[slot]); alloced++; diff --git a/sys/dev/pcmcia/if_malo_pcmcia.c b/sys/dev/pcmcia/if_malo_pcmcia.c index c09eaace40b1..036b6dbde065 100644 --- a/sys/dev/pcmcia/if_malo_pcmcia.c +++ b/sys/dev/pcmcia/if_malo_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_malo_pcmcia.c,v 1.23 2019/10/11 04:25:11 kre Exp $ */ +/* $NetBSD: if_malo_pcmcia.c,v 1.24 2019/11/10 21:16:36 chs Exp $ */ /* $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.23 2019/10/11 04:25:11 kre Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.24 2019/11/10 21:16:36 chs Exp $"); #ifdef _MODULE #include @@ -323,10 +323,10 @@ cmalo_attach(void *arg) sc->sc_flags |= MALO_FW_LOADED; /* allocate command buffer */ - sc->sc_cmd = malloc(MALO_CMD_BUFFER_SIZE, M_DEVBUF, M_NOWAIT); + sc->sc_cmd = malloc(MALO_CMD_BUFFER_SIZE, M_DEVBUF, M_WAITOK); /* allocate data buffer */ - sc->sc_data = malloc(MALO_DATA_BUFFER_SIZE, M_DEVBUF, M_NOWAIT); + sc->sc_data = malloc(MALO_DATA_BUFFER_SIZE, M_DEVBUF, M_WAITOK); /* enable interrupts */ cmalo_intr_mask(sc, 1); diff --git a/sys/dev/pcmcia/pcmcia_cis.c b/sys/dev/pcmcia/pcmcia_cis.c index c1b6bfec1a30..d247937e5dce 100644 --- a/sys/dev/pcmcia/pcmcia_cis.c +++ b/sys/dev/pcmcia/pcmcia_cis.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcmcia_cis.c,v 1.56 2019/02/03 03:19:27 mrg Exp $ */ +/* $NetBSD: pcmcia_cis.c,v 1.57 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis.c,v 1.56 2019/02/03 03:19:27 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis.c,v 1.57 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -76,7 +76,7 @@ static void decode_cftable_entry(struct pcmcia_tuple *, struct cis_state *); static void create_pf(struct cis_state *state) { - state->pf = malloc(sizeof(*state->pf), M_DEVBUF, M_NOWAIT|M_ZERO); + state->pf = malloc(sizeof(*state->pf), M_DEVBUF, M_WAITOK|M_ZERO); state->pf->number = state->count++; state->pf->last_config_index = -1; SIMPLEQ_INIT(&state->pf->cfe_head); @@ -1085,12 +1085,7 @@ decode_cftable_entry(struct pcmcia_tuple *tuple, struct cis_state *state) return; } if (num != state->default_cfe->number) { - cfe = malloc(sizeof(*cfe), M_DEVBUF, M_NOWAIT); - if (cfe == NULL) { - printf("Cannot allocate cfe entry\n"); - return; - } - + cfe = malloc(sizeof(*cfe), M_DEVBUF, M_WAITOK); *cfe = *state->default_cfe; SIMPLEQ_INSERT_TAIL(&state->pf->cfe_head, cfe, cfe_list); diff --git a/sys/dev/pcmcia/pcmcia_cis_quirks.c b/sys/dev/pcmcia/pcmcia_cis_quirks.c index e6fa100c8d79..e6c871835333 100644 --- a/sys/dev/pcmcia/pcmcia_cis_quirks.c +++ b/sys/dev/pcmcia/pcmcia_cis_quirks.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcmcia_cis_quirks.c,v 1.35 2013/09/14 13:13:33 joerg Exp $ */ +/* $NetBSD: pcmcia_cis_quirks.c,v 1.36 2019/11/10 21:16:36 chs Exp $ */ /* * Copyright (c) 1998 Marc Horowitz. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis_quirks.c,v 1.35 2013/09/14 13:13:33 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcmcia_cis_quirks.c,v 1.36 2019/11/10 21:16:36 chs Exp $"); #include #include @@ -309,10 +309,7 @@ match: * XXX: a driver which still calls pcmcia_card_attach * very early attach stage should be fixed instead. */ - pf = malloc(sizeof(*pf), M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (pf == NULL) - panic("pcmcia_check_cis_quirks: malloc pf"); + pf = malloc(sizeof(*pf), M_DEVBUF, M_WAITOK); *pf = *quirk->pf; SIMPLEQ_INIT(&pf->cfe_head); SIMPLEQ_INSERT_TAIL(&card->pf_head, pf, pf_list); @@ -322,10 +319,7 @@ match: /* * XXX: see above. */ - cfe = malloc(sizeof(*cfe), M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (cfe == NULL) - panic("pcmcia_check_cis_quirks: malloc cfe"); + cfe = malloc(sizeof(*cfe), M_DEVBUF, M_WAITOK); *cfe = *quirk->cfe; KASSERT(pf != NULL); SIMPLEQ_INSERT_TAIL(&pf->cfe_head, cfe, cfe_list); diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index f0480ae4ee55..8994e7270781 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_plip.c,v 1.33 2018/11/15 10:56:30 maxv Exp $ */ +/* $NetBSD: if_plip.c,v 1.34 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1997 Poul-Henning Kamp @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.33 2018/11/15 10:56:30 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.34 2019/11/10 21:16:37 chs Exp $"); /* * Parallel port TCP/IP interfaces added. I looked at the driver from @@ -398,12 +398,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, void *data) /* Allocate a buffer if necessary */ if (sc->sc_ifbuf == NULL) { sc->sc_ifbuf = malloc(sc->sc_if.if_mtu + - MLPIPHDRLEN, M_DEVBUF, M_NOWAIT); - if (!sc->sc_ifbuf) { - error = ENOBUFS; - ppbus_release_bus(ppbus, dev, 0, 0); - break; - } + MLPIPHDRLEN, M_DEVBUF, M_WAITOK); } ppbus_wctr(ppbus, IRQENABLE); @@ -422,13 +417,8 @@ lpioctl(struct ifnet *ifp, u_long cmd, void *data) if (sc->sc_if.if_mtu == ifr->ifr_mtu) break; ptr = sc->sc_ifbuf; - sc->sc_ifbuf = malloc(ifr->ifr_mtu+MLPIPHDRLEN, M_DEVBUF, - M_NOWAIT); - if (!sc->sc_ifbuf) { - sc->sc_ifbuf = ptr; - error = ENOBUFS; - break; - } + sc->sc_ifbuf = malloc(ifr->ifr_mtu + MLPIPHDRLEN, M_DEVBUF, + M_WAITOK); if (ptr) free(ptr,M_DEVBUF); /*FALLTHROUGH*/ diff --git a/sys/dev/qbus/uba.c b/sys/dev/qbus/uba.c index a2c4003bc44b..4733ae7627af 100644 --- a/sys/dev/qbus/uba.c +++ b/sys/dev/qbus/uba.c @@ -1,4 +1,4 @@ -/* $NetBSD: uba.c,v 1.80 2017/05/22 17:22:29 ragge Exp $ */ +/* $NetBSD: uba.c,v 1.81 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uba.c,v 1.80 2017/05/22 17:22:29 ragge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uba.c,v 1.81 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -137,9 +137,7 @@ uba_reset_establish(void (*reset)(device_t), device_t dev) struct uba_softc *uh = device_private(device_parent(dev)); struct uba_reset *ur; - ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_NOWAIT|M_ZERO); - if (ur == NULL) - panic("uba_reset_establish"); + ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_WAITOK|M_ZERO); ur->ur_dev = dev; ur->ur_reset = reset; diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index d38ec95a863a..5379f5e7990d 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.378 2019/10/30 16:00:13 martin Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.379 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***********************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.378 2019/10/30 16:00:13 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.379 2019/11/10 21:16:37 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -370,8 +370,7 @@ raidget(int unit, bool create) { mutex_exit(&raid_lock); if (!create) return NULL; - if ((sc = raidcreate(unit)) == NULL) - return NULL; + sc = raidcreate(unit); mutex_enter(&raid_lock); LIST_INSERT_HEAD(&raids, sc, sc_link); mutex_exit(&raid_lock); @@ -2713,19 +2712,7 @@ rf_get_component(RF_AutoConfig_t *ac_list, dev_t dev, struct vnode *vp, RF_ComponentLabel_t *clabel; RF_AutoConfig_t *ac; - clabel = malloc(sizeof(RF_ComponentLabel_t), M_RAIDFRAME, M_NOWAIT); - if (clabel == NULL) { -oomem: - while(ac_list) { - ac = ac_list; - if (ac->clabel) - free(ac->clabel, M_RAIDFRAME); - ac_list = ac_list->next; - free(ac, M_RAIDFRAME); - } - printf("RAID auto config: out of memory!\n"); - return NULL; /* XXX probably should panic? */ - } + clabel = malloc(sizeof(RF_ComponentLabel_t), M_RAIDFRAME, M_WAITOK); if (!raidread_component_label(secsize, dev, vp, clabel)) { /* Got the label. Does it look reasonable? */ @@ -2738,11 +2725,7 @@ oomem: #endif /* if it's reasonable, add it, else ignore it. */ ac = malloc(sizeof(RF_AutoConfig_t), M_RAIDFRAME, - M_NOWAIT); - if (ac == NULL) { - free(clabel, M_RAIDFRAME); - goto oomem; - } + M_WAITOK); strlcpy(ac->devname, cname, sizeof(ac->devname)); ac->dev = dev; ac->vp = vp; @@ -3089,12 +3072,8 @@ rf_create_auto_sets(RF_AutoConfig_t *ac_list) if (config_sets == NULL) { /* will need at least this one... */ - config_sets = (RF_ConfigSet_t *) - malloc(sizeof(RF_ConfigSet_t), - M_RAIDFRAME, M_NOWAIT); - if (config_sets == NULL) { - panic("rf_create_auto_sets: No memory!"); - } + config_sets = malloc(sizeof(RF_ConfigSet_t), + M_RAIDFRAME, M_WAITOK); /* this one is easy :) */ config_sets->ac = ac; config_sets->next = NULL; @@ -3114,12 +3093,8 @@ rf_create_auto_sets(RF_AutoConfig_t *ac_list) } if (cset==NULL) { /* didn't find a match above... new set..*/ - cset = (RF_ConfigSet_t *) - malloc(sizeof(RF_ConfigSet_t), - M_RAIDFRAME, M_NOWAIT); - if (cset == NULL) { - panic("rf_create_auto_sets: No memory!"); - } + cset = malloc(sizeof(RF_ConfigSet_t), + M_RAIDFRAME, M_WAITOK); cset->ac = ac; ac->next = NULL; cset->next = config_sets; @@ -3468,12 +3443,7 @@ rf_auto_config_set(RF_ConfigSet_t *cset) #endif /* 1. Create a config structure */ - config = malloc(sizeof(*config), M_RAIDFRAME, M_NOWAIT|M_ZERO); - if (config == NULL) { - printf("%s: Out of mem - config!?!?\n", __func__); - /* XXX do something more intelligent here. */ - return NULL; - } + config = malloc(sizeof(*config), M_RAIDFRAME, M_WAITOK|M_ZERO); /* 2. Figure out what RAID ID this one is supposed to live at @@ -3491,13 +3461,6 @@ rf_auto_config_set(RF_ConfigSet_t *cset) if (sc == NULL) sc = raidget(raidID, true); - if (sc == NULL) { - printf("%s: Out of mem - softc!?!?\n", __func__); - /* XXX do something more intelligent here. */ - free(config, M_RAIDFRAME); - return NULL; - } - raidPtr = &sc->sc_r; /* XXX all this stuff should be done SOMEWHERE ELSE! */ diff --git a/sys/dev/sbus/bpp.c b/sys/dev/sbus/bpp.c index 52c6e2092a9b..17f8e84160ee 100644 --- a/sys/dev/sbus/bpp.c +++ b/sys/dev/sbus/bpp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bpp.c,v 1.43 2018/09/03 16:29:33 riastradh Exp $ */ +/* $NetBSD: bpp.c,v 1.44 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.43 2018/09/03 16:29:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.44 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -212,7 +212,7 @@ bppattach(device_t parent, device_t self, void *aux) /* Allocate buffer XXX - should actually use dmamap_uio() */ dsc->sc_bufsz = 1024; - dsc->sc_buf = malloc(dsc->sc_bufsz, M_DEVBUF, M_NOWAIT); + dsc->sc_buf = malloc(dsc->sc_bufsz, M_DEVBUF, M_WAITOK); /* XXX read default state */ { diff --git a/sys/dev/sbus/esp_sbus.c b/sys/dev/sbus/esp_sbus.c index 36972240d340..0c6d95880847 100644 --- a/sys/dev/sbus/esp_sbus.c +++ b/sys/dev/sbus/esp_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.54 2018/02/06 09:21:07 mrg Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.55 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.54 2018/02/06 09:21:07 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.55 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -191,19 +191,9 @@ espattach_sbus(device_t parent, device_t self, void *aux) * allocate space for dma, in SUNW,fas there are no separate * dma device */ - lsc = malloc(sizeof(struct lsi64854_softc), M_DEVBUF, M_NOWAIT); - - if (lsc == NULL) { - aprint_error(": out of memory (lsi64854_softc)\n"); - return; - } + lsc = malloc(sizeof(struct lsi64854_softc), M_DEVBUF, M_WAITOK); lsc->sc_dev = malloc(sizeof(struct device), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (lsc->sc_dev == NULL) { - aprint_error(": out of memory (device_t)\n"); - free(lsc, M_DEVBUF); - return; - } + M_WAITOK | M_ZERO); esc->sc_dma = lsc; lsc->sc_bustag = sa->sa_bustag; diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index 4068838949b4..c88180c8597a 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $NetBSD: magma.c,v 1.60 2018/09/03 16:29:33 riastradh Exp $ */ +/* $NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998 Iain Hibbert @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.60 2018/09/03 16:29:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.61 2019/11/10 21:16:37 chs Exp $"); #if 0 #define MAGMA_DEBUG @@ -872,9 +872,7 @@ mtty_attach(device_t parent, device_t self, void *args) mp->mp_tty = tp; - mp->mp_rbuf = malloc(MTTY_RBUF_SIZE, M_DEVBUF, M_NOWAIT); - if (mp->mp_rbuf == NULL) break; - + mp->mp_rbuf = malloc(MTTY_RBUF_SIZE, M_DEVBUF, M_WAITOK); mp->mp_rend = mp->mp_rbuf + MTTY_RBUF_SIZE; chan = (chan + 1) % CD1400_NO_OF_CHANNELS; diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index 53ba8861031c..259e5c471b46 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $NetBSD: spif.c,v 1.31 2014/07/25 08:10:38 dholland Exp $ */ +/* $NetBSD: spif.c,v 1.32 2019/11/10 21:16:37 chs Exp $ */ /* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.31 2014/07/25 08:10:38 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.32 2019/11/10 21:16:37 chs Exp $"); #include "spif.h" #if NSPIF > 0 @@ -320,10 +320,7 @@ stty_attach(device_t parent, device_t dev, void *aux) sp->sp_sc = sc; sp->sp_channel = port; - sp->sp_rbuf = malloc(STTY_RBUF_SIZE, M_DEVBUF, M_NOWAIT); - if(sp->sp_rbuf == NULL) - break; - + sp->sp_rbuf = malloc(STTY_RBUF_SIZE, M_DEVBUF, M_WAITOK); sp->sp_rend = sp->sp_rbuf + STTY_RBUF_SIZE; } diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c index 44414c45902c..9637351e80b9 100644 --- a/sys/dev/sbus/zx.c +++ b/sys/dev/sbus/zx.c @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $ */ +/* $NetBSD: zx.c,v 1.45 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.44 2019/03/13 22:30:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.45 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -283,7 +283,7 @@ zx_attach(device_t parent, device_t self, void *args) if (sa->sa_nintr != 0) bus_intr_establish(bt, sa->sa_pri, IPL_NONE, zx_intr, sc); - sc->sc_cmap = malloc(768, M_DEVBUF, M_NOWAIT); + sc->sc_cmap = malloc(768, M_DEVBUF, M_WAITOK); zx_reset(sc); sc->sc_width = fb->fb_type.fb_width; diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index 952e60069933..8d88899193ef 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.134 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.133 2018/11/12 20:54:03 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.134 2019/11/10 21:16:37 chs Exp $"); #ifndef ATADEBUG #define ATADEBUG @@ -294,13 +294,7 @@ wdc_atapi_probe_device(struct atapibus_softc *sc, int target) id->atap_config & ATAPI_CFG_CMD_MASK, id->atap_config & ATAPI_CFG_DRQ_MASK); #endif - periph = scsipi_alloc_periph(M_NOWAIT); - if (periph == NULL) { - aprint_error_dev(sc->sc_dev, - "unable to allocate periph for drive %d\n", - target); - return; - } + periph = scsipi_alloc_periph(M_WAITOK); periph->periph_dev = NULL; periph->periph_channel = chan; periph->periph_switch = &atapi_probe_periphsw; diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c index 31f3a2f3cddf..091ffe3456c9 100644 --- a/sys/dev/scsipi/if_se.c +++ b/sys/dev/scsipi/if_se.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_se.c,v 1.102 2019/05/28 07:41:50 msaitoh Exp $ */ +/* $NetBSD: if_se.c,v 1.103 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1997 Ian W. Dall @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.102 2019/05/28 07:41:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.103 2019/11/10 21:16:37 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -340,13 +340,8 @@ seattach(device_t parent, device_t self, void *aux) * Initialize and attach a buffer */ sc->sc_tbuf = malloc(ETHERMTU + sizeof(struct ether_header), - M_DEVBUF, M_NOWAIT); - if (sc->sc_tbuf == 0) - panic("seattach: can't allocate transmit buffer"); - - sc->sc_rbuf = malloc(RBUF_LEN, M_DEVBUF, M_NOWAIT);/* A Guess */ - if (sc->sc_rbuf == 0) - panic("seattach: can't allocate receive buffer"); + M_DEVBUF, M_WAITOK); + sc->sc_rbuf = malloc(RBUF_LEN, M_DEVBUF, M_WAITOK);/* A Guess */ se_get_addr(sc, myaddr); @@ -1022,11 +1017,7 @@ se_ioctl(struct ifnet *ifp, u_long cmd, void *data) case SIOCADDMULTI: case SIOCDELMULTI: - sa = sockaddr_dup(ifreq_getaddr(cmd, ifr), M_NOWAIT); - if (sa == NULL) { - error = ENOBUFS; - break; - } + sa = sockaddr_dup(ifreq_getaddr(cmd, ifr), M_WAITOK); if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) { if (ifp->if_flags & IFF_RUNNING) { error = (cmd == SIOCADDMULTI) ? diff --git a/sys/dev/scsipi/scsiconf.c b/sys/dev/scsipi/scsiconf.c index d3fadcd49cf9..1602d61deef0 100644 --- a/sys/dev/scsipi/scsiconf.c +++ b/sys/dev/scsipi/scsiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.284 2019/03/28 10:44:29 kardel Exp $ */ +/* $NetBSD: scsiconf.c,v 1.285 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.284 2019/03/28 10:44:29 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.285 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -816,15 +816,7 @@ scsi_probe_device(struct scsibus_softc *sc, int target, int lun) if (scsipi_lookup_periph(chan, target, lun) != NULL) return (docontinue); - periph = scsipi_alloc_periph(M_NOWAIT); - if (periph == NULL) { -#ifdef DIAGNOSTIC - aprint_error_dev(sc->sc_dev, - "cannot allocate periph for target %d lun %d\n", - target, lun); -#endif - return (ENOMEM); - } + periph = scsipi_alloc_periph(M_WAITOK); periph->periph_channel = chan; periph->periph_switch = &scsi_probe_dev; diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index 0e6168abe9cf..48db5bb4f822 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.183 2019/09/19 03:37:31 msaitoh Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.184 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.183 2019/09/19 03:37:31 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.184 2019/11/10 21:16:37 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_scsi.h" @@ -1385,16 +1385,9 @@ scsipi_get_opcodeinfo(struct scsipi_periph *periph) * if timeout exists insert maximum into opcode table */ - data = malloc(len, M_DEVBUF, M_NOWAIT|M_ZERO); - if (data == NULL) { - SC_DEBUG(periph, SCSIPI_DB3, - ("unable to allocate data buffer " - "for REPORT SUPPORTED OPERATION CODES\n")); - return; - } + data = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); memset(&cmd, 0, sizeof(cmd)); - cmd.opcode = SCSI_MAINTENANCE_IN; cmd.svcaction = RSOC_REPORT_SUPPORTED_OPCODES; cmd.repoption = RSOC_RCTD|RSOC_ALL; @@ -1414,9 +1407,8 @@ scsipi_get_opcodeinfo(struct scsipi_periph *periph) SC_DEBUG(periph, SCSIPI_DB3, ("CMD LEN SA spec nom. time cmd timeout\n")); - struct scsipi_opcodes *tot = - (struct scsipi_opcodes *)malloc(sizeof(struct scsipi_opcodes), - M_DEVBUF, M_NOWAIT|M_ZERO); + struct scsipi_opcodes *tot = malloc(sizeof(struct scsipi_opcodes), + M_DEVBUF, M_WAITOK|M_ZERO); count = 0; while (tot != NULL && diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index dfd38214b4d7..822d8cacfb5a 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.238 2019/05/19 19:06:53 kardel Exp $ */ +/* $NetBSD: st.c,v 1.239 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.238 2019/05/19 19:06:53 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.239 2019/11/10 21:16:37 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_scsi.h" @@ -2426,10 +2426,7 @@ st_touch_tape(struct st_softc *st) int readsize; int error; - bf = malloc(1024, M_TEMP, M_NOWAIT); - if (bf == NULL) - return ENOMEM; - + bf = malloc(1024, M_TEMP, M_WAITOK); if ((error = st->ops(st, ST_OPS_MODESENSE, 0)) != 0) goto bad; diff --git a/sys/dev/sdmmc/sbt.c b/sys/dev/sdmmc/sbt.c index 0879d7c79e60..5d7158ff3ee6 100644 --- a/sys/dev/sdmmc/sbt.c +++ b/sys/dev/sdmmc/sbt.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbt.c,v 1.7 2018/10/14 17:37:40 jdolecek Exp $ */ +/* $NetBSD: sbt.c,v 1.8 2019/11/10 21:16:37 chs Exp $ */ /* $OpenBSD: sbt.c,v 1.9 2007/06/19 07:59:57 uwe Exp $ */ /* @@ -20,7 +20,7 @@ /* Driver for Type-A/B SDIO Bluetooth cards */ #include -__KERNEL_RCSID(0, "$NetBSD: sbt.c,v 1.7 2018/10/14 17:37:40 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbt.c,v 1.8 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -182,11 +182,7 @@ sbt_attach(device_t parent, device_t self, void *aux) /* It may be Type-B, but we use it only in Type-A mode. */ printf("%s: SDIO Bluetooth Type-A\n", DEVNAME(sc)); - sc->sc_buf = malloc(SBT_PKT_BUFSIZ, M_DEVBUF, M_NOWAIT); - if (sc->sc_buf == NULL) { - aprint_error("%s: can't allocate cmd buffer\n", DEVNAME(sc)); - return; - } + sc->sc_buf = malloc(SBT_PKT_BUFSIZ, M_DEVBUF, M_WAITOK); /* Enable the HCI packet transport read interrupt. */ CSR_WRITE_1(sc, SBT_REG_IENA, ISTAT_INTRD); diff --git a/sys/dev/sun/fb.c b/sys/dev/sun/fb.c index 17975c4c3d57..76942d37e68c 100644 --- a/sys/dev/sun/fb.c +++ b/sys/dev/sun/fb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fb.c,v 1.36 2016/04/21 18:06:06 macallan Exp $ */ +/* $NetBSD: fb.c,v 1.37 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.36 2016/04/21 18:06:06 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fb.c,v 1.37 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -172,21 +172,16 @@ fb_attach(struct fbdevice *fb, int isconsole) fbl = fbl->fb_next; nfb++; } - if ((fbl->fb_next = malloc(sizeof (struct fbdevlist), - M_DEVBUF, M_NOWAIT)) == NULL) - printf("%s: replacing %s at /dev/fb0\n", - device_xname(fb->fb_device), - device_xname(fblist.fb_dev->fb_device)); - else { - fbl = fbl->fb_next; - nfb++; - fbl->fb_dev = fblist.fb_dev; - fbl->fb_next = NULL; - aprint_normal_dev(fbl->fb_dev->fb_device, - "moved to /dev/fb%d\n", nfb); - aprint_normal_dev(fbl->fb_dev->fb_device, - "attached to /dev/fb0\n"); - } + fbl->fb_next = malloc(sizeof (struct fbdevlist), + M_DEVBUF, M_WAITOK); + fbl = fbl->fb_next; + nfb++; + fbl->fb_dev = fblist.fb_dev; + fbl->fb_next = NULL; + aprint_normal_dev(fbl->fb_dev->fb_device, + "moved to /dev/fb%d\n", nfb); + aprint_normal_dev(fbl->fb_dev->fb_device, + "attached to /dev/fb0\n"); fblist.fb_dev = fb; if (fb->fb_flags & FB_FORCE) seen_force = 1; @@ -197,13 +192,8 @@ fb_attach(struct fbdevice *fb, int isconsole) fbl = fbl->fb_next; nfb++; } - if ((fbl->fb_next = malloc(sizeof (struct fbdevlist), - M_DEVBUF, M_NOWAIT)) == NULL) { - aprint_error_dev(fb->fb_device, - "no space to attach after /dev/fb%d\n", - nfb); - return; - } + fbl->fb_next = malloc(sizeof (struct fbdevlist), + M_DEVBUF, M_WAITOK); fbl = fbl->fb_next; nfb++; } @@ -381,4 +371,3 @@ fb_setsize_eeprom(struct fbdevice *fb, int depth, int def_width, int def_height) fb->fb_linebytes = (fb->fb_type.fb_width * depth) / 8; #endif /* !SUN4U */ } - diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c index 21328385b6ed..dcc14e19ac15 100644 --- a/sys/dev/sun/kbd.c +++ b/sys/dev/sun/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.69 2018/02/08 10:52:05 mrg Exp $ */ +/* $NetBSD: kbd.c,v 1.70 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,7 +47,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.69 2018/02/08 10:52:05 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.70 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -509,8 +509,7 @@ kbd_cc_alloc(struct kbd_softc *k) { struct cons_channel *cc; - if ((cc = malloc(sizeof *cc, M_DEVBUF, M_NOWAIT)) == NULL) - return NULL; + cc = malloc(sizeof *cc, M_DEVBUF, M_WAITOK); /* our callbacks for the console driver */ cc->cc_private = k; diff --git a/sys/dev/tc/cfb.c b/sys/dev/tc/cfb.c index 83ee3333a2b5..52c49d28f33d 100644 --- a/sys/dev/tc/cfb.c +++ b/sys/dev/tc/cfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: cfb.c,v 1.62 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: cfb.c,v 1.63 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.62 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.63 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -258,12 +258,7 @@ cfbattach(device_t parent, device_t self, void *aux) } else { ri = malloc(sizeof(struct rasops_info), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - + M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ta->ta_addr; cfb_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/mfb.c b/sys/dev/tc/mfb.c index 5d04f3a72e29..c821e8c6263a 100644 --- a/sys/dev/tc/mfb.c +++ b/sys/dev/tc/mfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: mfb.c,v 1.60 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: mfb.c,v 1.61 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.60 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfb.c,v 1.61 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -237,13 +237,7 @@ mfbattach(device_t parent, device_t self, void *aux) } else { ri = malloc(sizeof(struct rasops_info), - M_DEVBUF, M_NOWAIT); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - memset(ri, 0, sizeof(struct rasops_info)); - + M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ta->ta_addr; mfb_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/px.c b/sys/dev/tc/px.c index a7b74a52d1fa..159dd8c90d72 100644 --- a/sys/dev/tc/px.c +++ b/sys/dev/tc/px.c @@ -1,4 +1,4 @@ -/* $NetBSD: px.c,v 1.40 2013/11/04 16:53:09 christos Exp $ */ +/* $NetBSD: px.c,v 1.41 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.40 2013/11/04 16:53:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.41 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -142,7 +142,7 @@ px_attach(device_t parent, device_t self, void *aux) if (stic_consinfo.si_slotbase == 0) si = &stic_consinfo; else { - si = malloc(sizeof(*si), M_DEVBUF, M_NOWAIT|M_ZERO); + si = malloc(sizeof(*si), M_DEVBUF, M_WAITOK | M_ZERO); } si->si_slotbase = ta->ta_addr; px_init(si, 0); diff --git a/sys/dev/tc/pxg.c b/sys/dev/tc/pxg.c index 9c6e15b1e648..7133a7a54129 100644 --- a/sys/dev/tc/pxg.c +++ b/sys/dev/tc/pxg.c @@ -1,4 +1,4 @@ -/* $NetBSD: pxg.c,v 1.35 2013/11/04 16:53:09 christos Exp $ */ +/* $NetBSD: pxg.c,v 1.36 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pxg.c,v 1.35 2013/11/04 16:53:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxg.c,v 1.36 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -141,7 +141,7 @@ pxg_attach(device_t parent, device_t self, void *aux) if (stic_consinfo.si_slotbase == 0) si = &stic_consinfo; else { - si = malloc(sizeof(*si), M_DEVBUF, M_NOWAIT|M_ZERO); + si = malloc(sizeof(*si), M_DEVBUF, M_WAITOK | M_ZERO); } si->si_slotbase = ta->ta_addr; pxg_init(si); diff --git a/sys/dev/tc/sfb.c b/sys/dev/tc/sfb.c index 02b26c8ca477..28a8a25bc493 100644 --- a/sys/dev/tc/sfb.c +++ b/sys/dev/tc/sfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: sfb.c,v 1.85 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: sfb.c,v 1.86 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.85 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.86 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -271,12 +271,7 @@ sfbattach(device_t parent, device_t self, void *aux) } else { ri = malloc(sizeof(struct rasops_info), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - + M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ta->ta_addr; sfb_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/sfbplus.c b/sys/dev/tc/sfbplus.c index 3de3a3f5240d..7df0bec94620 100644 --- a/sys/dev/tc/sfbplus.c +++ b/sys/dev/tc/sfbplus.c @@ -1,4 +1,4 @@ -/* $NetBSD: sfbplus.c,v 1.38 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: sfbplus.c,v 1.39 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.38 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.39 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -262,13 +262,7 @@ sfbpattach(device_t parent, device_t self, void *aux) sc->nscreens = 1; } else { - ri = malloc(sizeof(struct rasops_info), M_DEVBUF, M_NOWAIT); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - memset(ri, 0, sizeof(struct rasops_info)); - + ri = malloc(sizeof(struct rasops_info), M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ta->ta_addr; sfbp_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/stic.c b/sys/dev/tc/stic.c index f8f3c758d8db..d4ba18552e82 100644 --- a/sys/dev/tc/stic.c +++ b/sys/dev/tc/stic.c @@ -1,4 +1,4 @@ -/* $NetBSD: stic.c,v 1.53 2018/03/30 22:54:36 maya Exp $ */ +/* $NetBSD: stic.c,v 1.54 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: stic.c,v 1.53 2018/03/30 22:54:36 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stic.c,v 1.54 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -623,7 +623,7 @@ stic_setup_backing(struct stic_info *si, struct stic_screen *ss) int size; size = si->si_consw * si->si_consh * sizeof(*ss->ss_backing); - ss->ss_backing = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO); + ss->ss_backing = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); } static int diff --git a/sys/dev/tc/tfb.c b/sys/dev/tc/tfb.c index 703ee89cb3db..14069ca5b934 100644 --- a/sys/dev/tc/tfb.c +++ b/sys/dev/tc/tfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: tfb.c,v 1.62 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: tfb.c,v 1.63 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.62 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tfb.c,v 1.63 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -292,12 +292,7 @@ tfbattach(device_t parent, device_t self, void *aux) } else { ri = malloc(sizeof(struct rasops_info), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - + M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ta->ta_addr; tfb_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/xcfb.c b/sys/dev/tc/xcfb.c index 20e96035ef14..6610cf5b6d1f 100644 --- a/sys/dev/tc/xcfb.c +++ b/sys/dev/tc/xcfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: xcfb.c,v 1.56 2018/01/24 05:35:58 riastradh Exp $ */ +/* $NetBSD: xcfb.c,v 1.57 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.56 2018/01/24 05:35:58 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xcfb.c,v 1.57 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -225,13 +225,7 @@ xcfbattach(device_t parent, device_t self, void *aux) sc->nscreens = 1; } else { - ri = malloc(sizeof(struct rasops_info), M_DEVBUF, M_NOWAIT); - if (ri == NULL) { - printf(": can't alloc memory\n"); - return; - } - memset(ri, 0, sizeof(struct rasops_info)); - + ri = malloc(sizeof(struct rasops_info), M_DEVBUF, M_WAITOK | M_ZERO); ri->ri_hw = (void *)ioasic_base; xcfb_common_init(ri); sc->sc_ri = ri; diff --git a/sys/dev/tc/zs_ioasic.c b/sys/dev/tc/zs_ioasic.c index 4b334442b78e..44180f19e7fd 100644 --- a/sys/dev/tc/zs_ioasic.c +++ b/sys/dev/tc/zs_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs_ioasic.c,v 1.40 2009/05/12 13:21:22 cegger Exp $ */ +/* $NetBSD: zs_ioasic.c,v 1.41 2019/11/10 21:16:37 chs Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.40 2009/05/12 13:21:22 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.41 2019/11/10 21:16:37 chs Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -248,7 +248,7 @@ zs_ioasic_attach(device_t parent, device_t self, void *aux) zs_args.hwflags |= ZS_HWFLAG_CONSOLE; } else { cs = malloc(sizeof(struct zs_chanstate), - M_DEVBUF, M_NOWAIT|M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); zs_lock_init(cs); zc = zs_ioasic_get_chan_addr(d->iada_addr, channel); cs->cs_reg_csr = (volatile void *)&zc->zc_csr; diff --git a/sys/dev/tc/zskbd.c b/sys/dev/tc/zskbd.c index 3cca34154415..5652e10629ff 100644 --- a/sys/dev/tc/zskbd.c +++ b/sys/dev/tc/zskbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: zskbd.c,v 1.18 2015/01/02 21:32:26 jklos Exp $ */ +/* $NetBSD: zskbd.c,v 1.19 2019/11/10 21:16:37 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zskbd.c,v 1.18 2015/01/02 21:32:26 jklos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zskbd.c,v 1.19 2019/11/10 21:16:37 chs Exp $"); #include #include @@ -199,7 +199,7 @@ zskbd_attach(device_t parent, device_t self, void *aux) zsi = &zskbd_console_internal; } else { zsi = malloc(sizeof(struct zskbd_internal), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); zsi->zsi_ks.attmt.sendchar = zskbd_sendchar; zsi->zsi_ks.attmt.cookie = cs; zsi->zsi_cs = cs; diff --git a/sys/dev/usb/umass_scsipi.c b/sys/dev/usb/umass_scsipi.c index 8b3834db9331..d54aca613e11 100644 --- a/sys/dev/usb/umass_scsipi.c +++ b/sys/dev/usb/umass_scsipi.c @@ -1,4 +1,4 @@ -/* $NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $ */ +/* $NetBSD: umass_scsipi.c,v 1.63 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.62 2019/05/30 21:44:49 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.63 2019/11/10 21:16:38 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -550,13 +550,7 @@ umass_atapi_probe_device(struct atapibus_softc *atapi, int target) return; } - periph = scsipi_alloc_periph(M_NOWAIT); - if (periph == NULL) { - aprint_error_dev(atapi->sc_dev, - "can't allocate link for drive %d\n", target); - return; - } - + periph = scsipi_alloc_periph(M_WAITOK); DIF(UDMASS_UPPER, periph->periph_dbflags |= 1); /* XXX 1 */ periph->periph_channel = chan; periph->periph_switch = &atapi_probe_periphsw; diff --git a/sys/dev/vme/sc_vme.c b/sys/dev/vme/sc_vme.c index 0a7afe561001..2f50c6b92585 100644 --- a/sys/dev/vme/sc_vme.c +++ b/sys/dev/vme/sc_vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: sc_vme.c,v 1.17 2008/07/06 13:29:50 tsutsui Exp $ */ +/* $NetBSD: sc_vme.c,v 1.18 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c) 1996,2000,2001 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sc_vme.c,v 1.17 2008/07/06 13:29:50 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sc_vme.c,v 1.18 2019/11/10 21:16:38 chs Exp $"); #include "opt_ddb.h" @@ -188,10 +188,7 @@ sc_vme_attach(device_t parent, device_t self, void *aux) * Allocate DMA handles. */ i = SUNSCPAL_OPENINGS * sizeof(struct sunscpal_dma_handle); - sc->sc_dma_handles = malloc(i, M_DEVBUF, M_NOWAIT); - if (sc->sc_dma_handles == NULL) - panic("sc: DMA handle malloc failed"); - + sc->sc_dma_handles = malloc(i, M_DEVBUF, M_WAITOK); for (i = 0; i < SUNSCPAL_OPENINGS; i++) { sc->sc_dma_handles[i].dh_flags = 0; diff --git a/sys/dev/vme/si.c b/sys/dev/vme/si.c index 624fe71d59fb..cc550f3c816f 100644 --- a/sys/dev/vme/si.c +++ b/sys/dev/vme/si.c @@ -1,4 +1,4 @@ -/* $NetBSD: si.c,v 1.23 2008/12/17 19:13:02 cegger Exp $ */ +/* $NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c) 1996,2000 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.23 2008/12/17 19:13:02 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: si.c,v 1.24 2019/11/10 21:16:38 chs Exp $"); #include "opt_ddb.h" @@ -306,10 +306,7 @@ si_attach(device_t parent, device_t self, void *aux) * Allocate DMA handles. */ i = SCI_OPENINGS * sizeof(struct si_dma_handle); - sc->sc_dma = malloc(i, M_DEVBUF, M_NOWAIT); - if (sc->sc_dma == NULL) - panic("si: DMA handle malloc failed"); - + sc->sc_dma = malloc(i, M_DEVBUF, M_WAITOK); for (i = 0; i < SCI_OPENINGS; i++) { sc->sc_dma[i].dh_flags = 0; diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c index dbaf13ed1cbf..d529f96be5c4 100644 --- a/sys/dev/vme/xd.c +++ b/sys/dev/vme/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.95 2015/04/26 15:15:20 mlelstv Exp $ */ +/* $NetBSD: xd.c,v 1.96 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 1995 Charles D. Cranor @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.95 2015/04/26 15:15:20 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.96 2019/11/10 21:16:38 chs Exp $"); #undef XDC_DEBUG /* full debug */ #define XDC_DIAG /* extra sanity checks */ @@ -584,11 +584,8 @@ xdcattach(device_t parent, device_t self, void *aux) memset(xdc->iopbase, 0, XDC_MAXIOPB * sizeof(struct xd_iopb)); - xdc->reqs = (struct xd_iorq *) - malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (xdc->reqs == NULL) - panic("xdc malloc"); + xdc->reqs = malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), + M_DEVBUF, M_WAITOK|M_ZERO); /* init free list, iorq to iopb pointers, and non-zero fields in the * iopb which never change. */ diff --git a/sys/dev/vme/xy.c b/sys/dev/vme/xy.c index 95ebbdea3dac..919f59a42da2 100644 --- a/sys/dev/vme/xy.c +++ b/sys/dev/vme/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.99 2015/04/26 15:15:20 mlelstv Exp $ */ +/* $NetBSD: xy.c,v 1.100 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 1995 Charles D. Cranor @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.99 2015/04/26 15:15:20 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.100 2019/11/10 21:16:38 chs Exp $"); #undef XYC_DEBUG /* full debug */ #undef XYC_DIAG /* extra sanity checks */ @@ -490,11 +490,8 @@ xycattach(device_t parent, device_t self, void *aux) memset(xyc->iopbase, 0, XYC_MAXIOPB * sizeof(struct xy_iopb)); - xyc->reqs = (struct xy_iorq *) - malloc(XYC_MAXIOPB * sizeof(struct xy_iorq), - M_DEVBUF, M_NOWAIT|M_ZERO); - if (xyc->reqs == NULL) - panic("xyc malloc"); + xyc->reqs = malloc(XYC_MAXIOPB * sizeof(struct xy_iorq), + M_DEVBUF, M_WAITOK|M_ZERO); /* * init iorq to iopb pointers, and non-zero fields in the diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 8c26bd99f350..817679ea8e02 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.158 2019/07/25 20:26:39 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.159 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.158 2019/07/25 20:26:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.159 2019/11/10 21:16:38 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -460,9 +460,7 @@ wsdisplay_addscreen(struct wsdisplay_softc *sc, int idx, */ if (scrdesc->capabilities & WSSCREEN_RESIZE) { /* we want per screen wsscreen_descr */ - scrdescr2 = malloc(sizeof(struct wsscreen_descr), M_DEVBUF, M_NOWAIT); - if (scrdescr2 == NULL) - return ENOMEM; + scrdescr2 = malloc(sizeof(struct wsscreen_descr), M_DEVBUF, M_WAITOK); memcpy(scrdescr2, scrdesc, sizeof(struct wsscreen_descr)); scrdescr2->capabilities |= WSSCREEN_FREE; scrdesc = scrdescr2; @@ -845,9 +843,6 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux, mux = wsmux_getmux(kbdmux); else mux = wsmux_create("dmux", device_unit(sc->sc_dev)); - /* XXX panic()ing isn't nice, but attach cannot fail */ - if (mux == NULL) - panic("wsdisplay_common_attach: no memory"); sc->sc_input = &mux->sc_base; mux->sc_base.me_dispdv = sc->sc_dev; aprint_normal(" kbdmux %d", kbdmux); diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c index 0f1734657fe1..21d010261efe 100644 --- a/sys/dev/wscons/wsemul_vt100.c +++ b/sys/dev/wscons/wsemul_vt100.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.46 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.46 2019/11/10 21:16:38 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -253,14 +253,14 @@ wsemul_vt100_attach(int console, const struct wsscreen_descr *type, vd = &edp->bd; vd->cbcookie = cbcookie; - vd->tabs = malloc(1024, M_DEVBUF, M_NOWAIT); - vd->dblwid = malloc(1024, M_DEVBUF, M_NOWAIT|M_ZERO); + vd->tabs = malloc(1024, M_DEVBUF, M_WAITOK); + vd->dblwid = malloc(1024, M_DEVBUF, M_WAITOK|M_ZERO); vd->dw = 0; - vd->dcsarg = malloc(DCS_MAXLEN, M_DEVBUF, M_NOWAIT); - edp->isolatin1tab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT); - edp->decgraphtab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT); - edp->dectechtab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT); - edp->nrctab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT); + vd->dcsarg = malloc(DCS_MAXLEN, M_DEVBUF, M_WAITOK); + edp->isolatin1tab = malloc(128 * sizeof(int), M_DEVBUF, M_WAITOK); + edp->decgraphtab = malloc(128 * sizeof(int), M_DEVBUF, M_WAITOK); + edp->dectechtab = malloc(128 * sizeof(int), M_DEVBUF, M_WAITOK); + edp->nrctab = malloc(128 * sizeof(int), M_DEVBUF, M_WAITOK); vt100_initchartables(edp); wsemul_vt100_reset(edp); return edp; diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index 767c93f22493..dab1a3a35f40 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $ */ +/* $NetBSD: wsmux.c,v 1.64 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.64 2019/11/10 21:16:38 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -169,11 +169,7 @@ wsmux_getmux(int n) void *new; new = realloc(wsmuxdevs, (n + 1) * sizeof(*wsmuxdevs), - M_DEVBUF, M_ZERO | M_NOWAIT); - if (new == NULL) { - printf("wsmux_getmux: no memory for mux %d\n", n); - return NULL; - } + M_DEVBUF, M_ZERO | M_WAITOK); wsmuxdevs = new; nwsmux = n + 1; } @@ -181,8 +177,6 @@ wsmux_getmux(int n) sc = wsmuxdevs[n]; if (sc == NULL) { sc = wsmux_create("wsmux", n); - if (sc == NULL) - printf("wsmux: attach out of memory\n"); wsmuxdevs[n] = sc; } return (sc); @@ -659,15 +653,9 @@ wsmux_create(const char *name, int unit) /* XXX This is wrong -- should use autoconfiguraiton framework */ DPRINTF(("wsmux_create: allocating\n")); - sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT|M_ZERO); - if (sc == NULL) - return (NULL); + sc = malloc(sizeof *sc, M_DEVBUF, M_WAITOK|M_ZERO); sc->sc_base.me_dv = malloc(sizeof(struct device), M_DEVBUF, - M_NOWAIT|M_ZERO); - if (sc->sc_base.me_dv == NULL) { - free(sc, M_DEVBUF); - return NULL; - } + M_WAITOK|M_ZERO); TAILQ_INIT(&sc->sc_cld); snprintf(sc->sc_base.me_dv->dv_xname, sizeof sc->sc_base.me_dv->dv_xname, "%s%d", name, unit); diff --git a/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c b/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c index 79ff293b8948..7d4aa0d783ca 100644 --- a/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c +++ b/sys/external/bsd/drm/dist/bsd-core/drm_sysctl.c @@ -288,11 +288,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS mapcount++; tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER, - M_NOWAIT); - if (tempmaps == NULL) { - DRM_UNLOCK(); - return ENOMEM; - } + M_WAITOK); i = 0; TAILQ_FOREACH(map, &dev->maplist, link) @@ -355,7 +351,7 @@ static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS DRM_SPINLOCK(&dev->dma_lock); tempdma = *dma; templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER, - M_NOWAIT); + M_WAITOK); for (i = 0; i < dma->buf_count; i++) templists[i] = dma->buflist[i]->list; dma = &tempdma; @@ -412,11 +408,7 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS privcount++; tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER, - M_NOWAIT); - if (tempprivs == NULL) { - DRM_UNLOCK(); - return ENOMEM; - } + M_WAITOK); i = 0; TAILQ_FOREACH(priv, &dev->files, link) tempprivs[i++] = *priv; diff --git a/sys/fs/sysvbfs/bfs.c b/sys/fs/sysvbfs/bfs.c index cc1cabf3727a..0116dce814c6 100644 --- a/sys/fs/sysvbfs/bfs.c +++ b/sys/fs/sysvbfs/bfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: bfs.c,v 1.18 2014/12/26 15:22:15 hannken Exp $ */ +/* $NetBSD: bfs.c,v 1.19 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.18 2014/12/26 15:22:15 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.19 2019/11/10 21:16:38 chs Exp $"); #define BFS_DEBUG #include @@ -90,7 +90,7 @@ bfs_init2(struct bfs **bfsp, int bfs_sector, struct sector_io_ops *io, /* 1. */ DPRINTF(debug, "bfs sector = %d\n", bfs_sector); - if ((bfs = (void *)__MALLOC(sizeof(struct bfs), M_BFS, M_NOWAIT)) == 0) + if ((bfs = (void *)__MALLOC(sizeof(struct bfs), M_BFS, M_WAITOK)) == 0) return ENOMEM; memset(bfs, 0, sizeof *bfs); bfs->io = io; @@ -103,7 +103,7 @@ bfs_init2(struct bfs **bfsp, int bfs_sector, struct sector_io_ops *io, } DPRINTF(debug, "bfs super block + inode area = %zd\n", memsize); bfs->super_block_size = memsize; - if ((p = (void *)__MALLOC(memsize, M_BFS, M_NOWAIT)) == 0) { + if ((p = (void *)__MALLOC(memsize, M_BFS, M_WAITOK)) == 0) { bfs_fini(bfs); return ENOMEM; } @@ -114,7 +114,7 @@ bfs_init2(struct bfs **bfsp, int bfs_sector, struct sector_io_ops *io, } DPRINTF(debug, "bfs dirent area = %zd\n", memsize); bfs->dirent_size = memsize; - if ((p = (void *)__MALLOC(memsize, M_BFS, M_NOWAIT)) == 0) { + if ((p = (void *)__MALLOC(memsize, M_BFS, M_WAITOK)) == 0) { bfs_fini(bfs); return ENOMEM; } diff --git a/sys/net/agr/if_agrether.c b/sys/net/agr/if_agrether.c index 4ca021f077a1..4c4fafeb5079 100644 --- a/sys/net/agr/if_agrether.c +++ b/sys/net/agr/if_agrether.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_agrether.c,v 1.10 2017/12/06 04:37:00 ozaki-r Exp $ */ +/* $NetBSD: if_agrether.c,v 1.11 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c)2005 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_agrether.c,v 1.10 2017/12/06 04:37:00 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_agrether.c,v 1.11 2019/11/10 21:16:38 chs Exp $"); #include #include @@ -91,10 +91,7 @@ agrether_ctor(struct agr_softc *sc, struct ifnet *ifp_port) struct ethercom *ec = (void *)ifp; struct agrether_private *priv; - priv = malloc(sizeof(*priv), M_DEVBUF, M_NOWAIT | M_ZERO); - if (!priv) - return ENOMEM; - + priv = malloc(sizeof(*priv), M_DEVBUF, M_WAITOK | M_ZERO); agr_mc_init(sc, &priv->aep_multiaddrs); sc->sc_iftprivate = priv; diff --git a/sys/net/agr/if_agrsubr.c b/sys/net/agr/if_agrsubr.c index b50f7fb21fe7..40300faa0bcd 100644 --- a/sys/net/agr/if_agrsubr.c +++ b/sys/net/agr/if_agrsubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_agrsubr.c,v 1.12 2018/01/25 03:54:57 christos Exp $ */ +/* $NetBSD: if_agrsubr.c,v 1.13 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c)2005 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_agrsubr.c,v 1.12 2018/01/25 03:54:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_agrsubr.c,v 1.13 2019/11/10 21:16:38 chs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -139,10 +139,7 @@ agr_mc_add(struct agr_multiaddrs *ama, const struct sockaddr *sa) return 0; } - ame = malloc(sizeof(*ame), M_DEVBUF, M_NOWAIT | M_ZERO); - if (ame == NULL) - return ENOMEM; - + ame = malloc(sizeof(*ame), M_DEVBUF, M_WAITOK | M_ZERO); memcpy(&ame->ame_ifr.ifr_ss, sa, sa->sa_len); ame->ame_refcnt = 1; TAILQ_INSERT_TAIL(&ama->ama_addrs, ame, ame_q); diff --git a/sys/net80211/ieee80211_acl.c b/sys/net80211/ieee80211_acl.c index 29a530c49785..69805159cd62 100644 --- a/sys/net80211/ieee80211_acl.c +++ b/sys/net80211/ieee80211_acl.c @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_acl.c,v 1.4 2005/08/13 17:31:48 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.9 2011/06/12 00:07:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.10 2019/11/10 21:16:38 chs Exp $"); #endif /* @@ -99,9 +99,7 @@ acl_attach(struct ieee80211com *ic) struct aclstate *as; as = malloc(sizeof(struct aclstate), - M_80211_ACL, M_NOWAIT | M_ZERO); - if (as == NULL) - return 0; + M_80211_ACL, M_WAITOK | M_ZERO); ACL_LOCK_INIT(as, "acl"); TAILQ_INIT(&as->as_list); as->as_policy = ACL_POLICY_OPEN; @@ -169,13 +167,7 @@ acl_add(struct ieee80211com *ic, const u_int8_t mac[IEEE80211_ADDR_LEN]) struct acl *acl, *new; int hash; - new = malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO); - if (new == NULL) { - IEEE80211_DPRINTF(ic, IEEE80211_MSG_ACL, - "ACL: add %s failed, no memory\n", ether_sprintf(mac)); - /* XXX statistic */ - return ENOMEM; - } + new = malloc(sizeof(struct acl), M_80211_ACL, M_WAITOK | M_ZERO); ACL_LOCK(as); hash = ACL_HASH(mac); @@ -294,9 +286,7 @@ acl_getioctl(struct ieee80211com *ic, struct ieee80211req *ireq) ireq->i_len = space; /* return required space */ return 0; /* NB: must not error */ } - ap = malloc(space, M_TEMP, M_NOWAIT); - if (ap == NULL) - return ENOMEM; + ap = malloc(space, M_TEMP, M_WAITOK); i = 0; ACL_LOCK(as); TAILQ_FOREACH(acl, &as->as_list, acl_list) { diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index d00a19b8ca73..2288709511d9 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_ioctl.c,v 1.66 2019/05/17 04:08:54 msaitoh Exp $ */ +/* $NetBSD: ieee80211_ioctl.c,v 1.67 2019/11/10 21:16:38 chs Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.66 2019/05/17 04:08:54 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.67 2019/11/10 21:16:38 chs Exp $"); #endif /* @@ -1229,10 +1229,7 @@ ieee80211_ioctl_getstainfo(struct ieee80211com *ic, struct ieee80211req *ireq) void *p; space = req.space; - /* XXX M_WAITOK after driver lock released */ - p = malloc(space, M_TEMP, M_NOWAIT); - if (p == NULL) - return ENOMEM; + p = malloc(space, M_TEMP, M_WAITOK); req.si = p; ieee80211_iterate_nodes(&ic->ic_sta, get_sta_info, &req); ireq->i_len = space - req.space; diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 747b9e4dfbb8..e37de0e467a8 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee80211_node.c,v 1.75 2018/01/18 17:59:29 maxv Exp $ */ +/* $NetBSD: ieee80211_node.c,v 1.76 2019/11/10 21:16:38 chs Exp $ */ /* * Copyright (c) 2001 Atsushi Onoe @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.75 2018/01/18 17:59:29 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.76 2019/11/10 21:16:38 chs Exp $"); #endif #ifdef _KERNEL_OPT @@ -134,20 +134,11 @@ ieee80211_node_lateattach(struct ieee80211com *ic) if (ic->ic_max_aid > IEEE80211_AID_MAX) ic->ic_max_aid = IEEE80211_AID_MAX; ic->ic_aid_bitmap = malloc(howmany(ic->ic_max_aid, 32) * - sizeof(u_int32_t), M_DEVBUF, M_NOWAIT | M_ZERO); - if (ic->ic_aid_bitmap == NULL) { - /* XXX no way to recover */ - printf("%s: no memory for AID bitmap!\n", __func__); - ic->ic_max_aid = 0; - } + sizeof(u_int32_t), M_DEVBUF, M_WAITOK | M_ZERO); /* XXX defer until using hostap/ibss mode */ ic->ic_tim_len = howmany(ic->ic_max_aid, 8) * sizeof(u_int8_t); - ic->ic_tim_bitmap = malloc(ic->ic_tim_len, M_DEVBUF, M_NOWAIT | M_ZERO); - if (ic->ic_tim_bitmap == NULL) { - /* XXX no way to recover */ - printf("%s: no memory for TIM bitmap!\n", __func__); - } + ic->ic_tim_bitmap = malloc(ic->ic_tim_len, M_DEVBUF, M_WAITOK | M_ZERO); ieee80211_node_table_init(ic, &ic->ic_sta, "station", IEEE80211_INACT_INIT, ic->ic_crypto.cs_max_keyix, @@ -2512,11 +2503,7 @@ ieee80211_node_table_init(struct ieee80211com *ic, if (nt->nt_keyixmax > 0) { nt->nt_keyixmap = malloc(keyixmax * sizeof(struct ieee80211_node *), M_80211_NODE, - M_NOWAIT | M_ZERO); - if (nt->nt_keyixmap == NULL) - if_printf(ic->ic_ifp, - "Cannot allocate key index map with %u entries\n", - keyixmax); + M_WAITOK | M_ZERO); } else nt->nt_keyixmap = NULL; } diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index d43c4cd6da7f..0bccf7ad3f19 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.103 2019/06/01 19:13:41 joerg Exp $ */ +/* $NetBSD: ip_carp.c,v 1.104 2019/11/10 21:16:38 chs Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.103 2019/06/01 19:13:41 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.104 2019/11/10 21:16:38 chs Exp $"); /* * TODO: @@ -1655,9 +1655,7 @@ carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp) return (EINVAL); if (ifp->if_carp == NULL) { - ncif = malloc(sizeof(*cif), M_IFADDR, M_NOWAIT); - if (ncif == NULL) - return (ENOBUFS); + ncif = malloc(sizeof(*cif), M_IFADDR, M_WAITOK); if ((error = ifpromisc(ifp, 1))) { free(ncif, M_IFADDR); return (error);