diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2000-12-03 13:18:49 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2000-12-03 13:18:49 +0000 |
commit | f2af31fc6309e40867655d45eb934422345844c6 (patch) | |
tree | d5d2fbf37064bfab8b343765e6b079930638d1ea | |
parent | ce16361e1971391339a60ad4359a0272f772bfda (diff) | |
download | FreeBSD-src-f2af31fc6309e40867655d45eb934422345844c6.zip FreeBSD-src-f2af31fc6309e40867655d45eb934422345844c6.tar.gz |
Check return value of malloc correctly and use M_ZERO.
-rw-r--r-- | sys/i386/isa/labpc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c index ab6f4b8..1f0800c 100644 --- a/sys/i386/isa/labpc.c +++ b/sys/i386/isa/labpc.c @@ -407,14 +407,13 @@ labpcinit(void) if (NLABPC > MAX_UNITS) return 0; - labpcs = malloc(NLABPC * sizeof(struct ctlr *), M_DEVBUF, M_NOWAIT); - if (labpcs) - { - bzero(labpcs, NLABPC * sizeof(struct ctlr *)); - return 1; - } + labpcs = malloc(NLABPC * sizeof(struct ctlr *), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (labpcs == NULL) + return 0; + cdevsw_add(&labpc_cdevsw); - return 0; + return 1; } static int |