summaryrefslogtreecommitdiff
path: root/sys/dev/pci/mpii.c
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2011-06-17 07:06:48 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2011-06-17 07:06:48 +0000
commit588580a3636f1d2f89071c40a24811393a93accc (patch)
treefe14f36309c4c36297658840fbee97ea66114ab6 /sys/dev/pci/mpii.c
parentf54f5c33e3808aca4c742c69b64f7a9619f240cb (diff)
M_WAITOK cleanup of two cases:
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is pointless (malloc() will panic if it can't allocate) so remove the check and the call. 2) Allocating with M_WAITOK, checking for NULL, and then gracefully handling failure to allocate is pointless. Instead also pass M_CANFAIL so malloc() doesn't panic so we can actually handle it gracefully. 1) was done using Coccinelle. Input from oga. ok miod.
Diffstat (limited to 'sys/dev/pci/mpii.c')
-rw-r--r--sys/dev/pci/mpii.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index 1cab14d016b..d1be9cbe1f1 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpii.c,v 1.42 2011/05/25 00:12:46 dlg Exp $ */
+/* $OpenBSD: mpii.c,v 1.43 2011/06/17 07:06:47 mk Exp $ */
/*
* Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru>
* Copyright (c) 2009 James Giannoules
@@ -5285,7 +5285,7 @@ mpii_create_sensors(struct mpii_softc *sc)
int i;
sc->sc_sensors = malloc(sizeof(struct ksensor) * sc->sc_vd_count,
- M_DEVBUF, M_WAITOK | M_ZERO);
+ M_DEVBUF, M_WAITOK | M_CANFAIL | M_ZERO);
if (sc->sc_sensors == NULL)
return (1);
sc->sc_nsensors = sc->sc_vd_count;