From: patrick Date: Sat, 6 Aug 2016 18:21:34 +0000 (+0000) Subject: Always allocate intrhand with M_WAITOK. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a8511e668401a33894bf96192e05809cb00444ef;p=openbsd Always allocate intrhand with M_WAITOK. Requested by and ok kettenis@ --- diff --git a/sys/arch/armv7/omap/intc.c b/sys/arch/armv7/omap/intc.c index 6fb563266d0..a68a5be5741 100644 --- a/sys/arch/armv7/omap/intc.c +++ b/sys/arch/armv7/omap/intc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intc.c,v 1.6 2016/08/06 10:07:45 jsg Exp $ */ +/* $OpenBSD: intc.c,v 1.7 2016/08/06 18:21:34 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * @@ -364,11 +364,7 @@ intc_intr_establish(int irqno, int level, int (*func)(void *), irqno, name); psw = disable_interrupts(PSR_I); - /* no point in sleeping unless someone can free memory. */ - ih = (struct intrhand *)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); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = level; diff --git a/sys/arch/armv7/omap/omgpio.c b/sys/arch/armv7/omap/omgpio.c index 700e25362cd..c964553093f 100644 --- a/sys/arch/armv7/omap/omgpio.c +++ b/sys/arch/armv7/omap/omgpio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omgpio.c,v 1.7 2016/07/17 00:25:21 jsg Exp $ */ +/* $OpenBSD: omgpio.c,v 1.8 2016/08/06 18:21:34 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * @@ -616,11 +616,7 @@ omgpio_intr_establish(struct omgpio_softc *sc, unsigned int gpio, int level, int psw = disable_interrupts(PSR_I); - /* no point in sleeping unless someone can free memory. */ - ih = (struct intrhand *)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); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = level; diff --git a/sys/arch/armv7/sunxi/sxiintc.c b/sys/arch/armv7/sunxi/sxiintc.c index 452361ecd76..e593997afc1 100644 --- a/sys/arch/armv7/sunxi/sxiintc.c +++ b/sys/arch/armv7/sunxi/sxiintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiintc.c,v 1.1 2016/08/05 20:38:17 kettenis Exp $ */ +/* $OpenBSD: sxiintc.c,v 1.2 2016/08/06 18:21:34 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn * Copyright (c) 2013 Artturi Alm @@ -388,11 +388,7 @@ sxiintc_intr_establish(int irq, int level, int (*func)(void *), psw = disable_interrupts(PSR_I); - /* no point in sleeping unless someone can free memory. */ - ih = (struct intrhand *)malloc (sizeof *ih, M_DEVBUF, - cold ? M_NOWAIT : M_WAITOK); - if (ih == NULL) - panic("intr_establish: can't malloc handler info\n"); + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; ih->ih_ipl = level;