Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci M_WAITOK cannot fail, so remove the test branche...
details: https://anonhg.NetBSD.org/src/rev/67383890dec0
branches: trunk
changeset: 355888:67383890dec0
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Aug 20 10:55:37 2017 +0000
description:
M_WAITOK cannot fail, so remove the test branches. Otherwise it looks
like leak/uninitialized area.
diffstat:
sys/dev/pci/oboe.c | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)
diffs (56 lines):
diff -r 341c27188b80 -r 67383890dec0 sys/dev/pci/oboe.c
--- a/sys/dev/pci/oboe.c Sun Aug 20 10:17:55 2017 +0000
+++ b/sys/dev/pci/oboe.c Sun Aug 20 10:55:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: oboe.c,v 1.43 2015/07/24 06:17:10 martin Exp $ */
+/* $NetBSD: oboe.c,v 1.44 2017/08/20 10:55:37 maxv Exp $ */
/* XXXXFVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage */
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.43 2015/07/24 06:17:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.44 2017/08/20 10:55:37 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -641,9 +641,7 @@
/* XXX */
uintptr_t addr =
(uintptr_t)malloc(OBOE_TASK_BUF_LEN, M_DEVBUF, M_WAITOK);
- if (addr == 0) {
- goto bad;
- }
+
addr &= ~(sizeof (struct OboeTaskFile) - 1);
addr += sizeof (struct OboeTaskFile);
sc->sc_taskfile = (struct OboeTaskFile *) addr;
@@ -653,26 +651,15 @@
malloc(TX_BUF_SZ, M_DEVBUF, M_WAITOK);
sc->sc_xmit_stores[i] =
malloc(TX_BUF_SZ, M_DEVBUF, M_WAITOK);
- if (sc->sc_xmit_bufs[i] == NULL ||
- sc->sc_xmit_stores[i] == NULL) {
- goto bad;
- }
}
for (i = 0; i < RX_SLOTS; ++i) {
sc->sc_recv_bufs[i] =
malloc(RX_BUF_SZ, M_DEVBUF, M_WAITOK);
sc->sc_recv_stores[i] =
malloc(RX_BUF_SZ, M_DEVBUF, M_WAITOK);
- if (sc->sc_recv_bufs[i] == NULL ||
- sc->sc_recv_stores[i] == NULL) {
- goto bad;
- }
}
return 0;
-bad:
- printf("oboe: malloc for buffers failed()\n");
- return 1;
}
static void
Home |
Main Index |
Thread Index |
Old Index