summaryrefslogtreecommitdiff
path: root/sys/dev/usb/hid.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/usb/hid.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/usb/hid.c')
-rw-r--r--sys/dev/usb/hid.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c
index 3e9df98fe29..7cfb771b3ca 100644
--- a/sys/dev/usb/hid.c
+++ b/sys/dev/usb/hid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hid.c,v 1.23 2011/04/05 15:03:02 miod Exp $ */
+/* $OpenBSD: hid.c,v 1.24 2011/06/17 07:06:47 mk Exp $ */
/* $NetBSD: hid.c,v 1.23 2002/07/11 21:14:25 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
@@ -89,8 +89,6 @@ hid_start_parse(void *d, int len, enum hid_kind kind)
struct hid_data *s;
s = malloc(sizeof *s, M_TEMP, M_WAITOK | M_ZERO);
- if (s == NULL)
- panic("hid_start_parse");
s->start = s->p = d;
s->end = (char *)d + len;