Call malloc(9) with M_ZERO flag instead of bzero() after malloc().

XXX It seems these attachments need to be rewritten for modern config(9)..
This commit is contained in:
tsutsui 2002-01-14 13:39:14 +00:00
parent bcba62925f
commit ab04f9daae
2 changed files with 6 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fea.c,v 1.24 2001/11/13 12:47:33 lukem Exp $ */
/* $NetBSD: if_fea.c,v 1.25 2002/01/14 13:39:14 tsutsui Exp $ */
/*-
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_fea.c,v 1.24 2001/11/13 12:47:33 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_fea.c,v 1.25 2002/01/14 13:39:14 tsutsui Exp $");
#include "opt_inet.h"
@ -250,14 +250,13 @@ pdq_eisa_attach(
resvaddr_t *mspace;
int irq = ffs(ed->ioconf.irq) - 1;
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_WAITOK);
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
if (sc == NULL) {
printf("fea%d: malloc failed!\n", sc->sc_if.if_unit);
return -1;
}
pdqs_eisa[ed->unit] = sc;
bzero(sc, sizeof(pdq_softc_t)); /* Zero out the softc*/
sc->sc_if.if_name = "fea";
sc->sc_if.if_unit = ed->unit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fpa.c,v 1.37 2001/11/13 07:48:43 lukem Exp $ */
/* $NetBSD: if_fpa.c,v 1.38 2002/01/14 13:39:15 tsutsui Exp $ */
/*-
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_fpa.c,v 1.37 2001/11/13 07:48:43 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_fpa.c,v 1.38 2002/01/14 13:39:15 tsutsui Exp $");
#ifdef __NetBSD__
#include "opt_inet.h"
@ -205,11 +205,10 @@ pdq_pci_attach(
pci_conf_write(config_id, PCI_CFLT, data);
}
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT);
sc = (pdq_softc_t *) malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
if (sc == NULL)
return;
bzero(sc, sizeof(pdq_softc_t)); /* Zero out the softc*/
if (!pci_map_mem(config_id, PCI_CBMA, &va_csrs, &pa_csrs)) {
free((void *) sc, M_DEVBUF);
return;