From f5461d41b129fefc48ff4c9ded82554394de9bf0 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sat, 6 Oct 2007 23:50:56 +0000 Subject: Simpliest memset(,0,) -> M_ZERO changes. One (caddr *) cast removal, otherwise just adding M_ZERO to malloc() and removing the immediately adjacent memset(,0,). --- sys/dev/usb/umidi.c | 7 +++---- sys/dev/usb/usb_subr.c | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'sys/dev/usb') diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c index b0282d82961..7cb708d5ba7 100644 --- a/sys/dev/usb/umidi.c +++ b/sys/dev/usb/umidi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umidi.c,v 1.22 2007/06/14 10:11:16 mbalmer Exp $ */ +/* $OpenBSD: umidi.c,v 1.23 2007/10/06 23:50:55 krw Exp $ */ /* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -993,11 +993,10 @@ static usbd_status alloc_all_mididevs(struct umidi_softc *sc, int nmidi) { sc->sc_num_mididevs = nmidi; - sc->sc_mididevs = malloc(sizeof(*sc->sc_mididevs)*nmidi, - M_USBDEV, M_WAITOK); + sc->sc_mididevs = malloc(sizeof(*sc->sc_mididevs)*nmidi, M_USBDEV, + M_WAITOK | M_ZERO); if (!sc->sc_mididevs) return USBD_NOMEM; - memset(sc->sc_mididevs, 0, sizeof(*sc->sc_mididevs)*nmidi); return USBD_NORMAL_COMPLETION; } diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index c3dacfe467e..c30b6b5c70b 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.60 2007/09/11 13:39:34 gilles Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.61 2007/10/06 23:50:55 krw Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -976,10 +976,9 @@ usbd_new_device(struct device *parent, usbd_bus_handle bus, int depth, return (USBD_NO_ADDR); } - dev = malloc(sizeof *dev, M_USB, M_NOWAIT); + dev = malloc(sizeof *dev, M_USB, M_NOWAIT | M_ZERO); if (dev == NULL) return (USBD_NOMEM); - memset(dev, 0, sizeof *dev); dev->bus = bus; -- cgit v1.2.3