diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-09-07 17:58:40 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-09-07 17:58:40 +0000 |
commit | e5739ba666912f5b12c6aba38eacdc9ca5c8e28c (patch) | |
tree | 2a777abaebb1f5b261580c46e4d6f8ba958f76f2 /sys | |
parent | edd3236a722f0794b12613e6096db704b2cd904b (diff) |
The obvious bzero/memset -> M_ZERO changes.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/aic79xx.c | 17 | ||||
-rw-r--r-- | sys/dev/ic/aic79xx_openbsd.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx.c | 29 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx_openbsd.c | 5 |
4 files changed, 21 insertions, 35 deletions
diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c index 1d16c7494fb..c68a4b01bb8 100644 --- a/sys/dev/ic/aic79xx.c +++ b/sys/dev/ic/aic79xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx.c,v 1.39 2007/05/09 19:24:56 miod Exp $ */ +/* $OpenBSD: aic79xx.c,v 1.40 2007/09/07 17:58:39 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -2818,7 +2818,7 @@ ahd_alloc_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel) && ahd->enabled_targets[scsi_id] != master_tstate) panic("%s: ahd_alloc_tstate - Target already allocated", ahd_name(ahd)); - tstate = malloc(sizeof(*tstate), M_DEVBUF, M_NOWAIT); + tstate = malloc(sizeof(*tstate), M_DEVBUF, M_NOWAIT | M_ZERO); if (tstate == NULL) return (NULL); @@ -2837,8 +2837,7 @@ ahd_alloc_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel) memset(&tstate->transinfo[i].goal, 0, sizeof(tstate->transinfo[i].goal)); } - } else - memset(tstate, 0, sizeof(*tstate)); + } ahd->enabled_targets[scsi_id] = tstate; return (tstate); } @@ -6190,14 +6189,11 @@ ahd_init(struct ahd_softc *ahd) AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK); ahd->stack_size = ahd_probe_stack_size(ahd); - ahd->saved_stack = malloc(ahd->stack_size * sizeof(uint16_t), - M_DEVBUF, M_NOWAIT); + ahd->saved_stack = malloc(ahd->stack_size * sizeof(uint16_t), M_DEVBUF, + M_NOWAIT | M_ZERO); if (ahd->saved_stack == NULL) return (ENOMEM); - /* Zero the memory */ - memset(ahd->saved_stack, 0, ahd->stack_size * sizeof(uint16_t)); - /* * Verify that the compiler hasn't over-agressively * padded important structures. @@ -9608,14 +9604,13 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) return; } } - lstate = malloc(sizeof(*lstate), M_DEVBUF, M_NOWAIT); + lstate = malloc(sizeof(*lstate), M_DEVBUF, M_NOWAIT | M_ZERO); if (lstate == NULL) { xpt_print_path(ccb->ccb_h.path); printf("Couldn't allocate lstate\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; return; } - memset(lstate, 0, sizeof(*lstate)); status = xpt_create_path(&lstate->path, /*periph*/NULL, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c index d65be5480d8..d45b5ce72c9 100644 --- a/sys/dev/ic/aic79xx_openbsd.c +++ b/sys/dev/ic/aic79xx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx_openbsd.c,v 1.26 2006/11/28 23:59:45 dlg Exp $ */ +/* $OpenBSD: aic79xx_openbsd.c,v 1.27 2007/09/07 17:58:39 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -609,10 +609,9 @@ ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) { if (sizeof(struct ahd_platform_data) > 0) { ahd->platform_data = malloc(sizeof(struct ahd_platform_data), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT | M_ZERO); if (ahd->platform_data == NULL) return (ENOMEM); - bzero(ahd->platform_data, sizeof(struct ahd_platform_data)); } return (0); diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index 9d29b7a23db..3d47791d3c4 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx.c,v 1.76 2007/05/26 21:53:16 krw Exp $ */ +/* $OpenBSD: aic7xxx.c,v 1.77 2007/09/07 17:58:39 krw Exp $ */ /* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -40,7 +40,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: aic7xxx.c,v 1.76 2007/05/26 21:53:16 krw Exp $ + * $Id: aic7xxx.c,v 1.77 2007/09/07 17:58:39 krw Exp $ */ /* * Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003 @@ -1644,8 +1644,7 @@ ahc_alloc_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel) && ahc->enabled_targets[scsi_id] != master_tstate) panic("%s: ahc_alloc_tstate - Target already allocated", ahc_name(ahc)); - tstate = (struct ahc_tmode_tstate*)malloc(sizeof(*tstate), - M_DEVBUF, M_NOWAIT); + tstate = malloc(sizeof(*tstate), M_DEVBUF, M_NOWAIT | M_ZERO); if (tstate == NULL) return (NULL); @@ -1665,8 +1664,7 @@ ahc_alloc_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel) memset(&tstate->transinfo[i].goal, 0, sizeof(tstate->transinfo[i].goal)); } - } else - memset(tstate, 0, sizeof(*tstate)); + } ahc->enabled_targets[scsi_id] = tstate; return (tstate); } @@ -3889,11 +3887,10 @@ ahc_softc_init(struct ahc_softc *ahc) ahc->pause = ahc->unpause | PAUSE; /* XXX The shared scb data stuff should be deprecated */ if (ahc->scb_data == NULL) { - ahc->scb_data = malloc(sizeof(*ahc->scb_data), - M_DEVBUF, M_NOWAIT); + ahc->scb_data = malloc(sizeof(*ahc->scb_data), M_DEVBUF, + M_NOWAIT | M_ZERO); if (ahc->scb_data == NULL) return (ENOMEM); - memset(ahc->scb_data, 0, sizeof(*ahc->scb_data)); } return (0); @@ -4253,12 +4250,10 @@ ahc_init_scbdata(struct ahc_softc *ahc) SLIST_INIT(&scb_data->sg_maps); /* Allocate SCB resources */ - scb_data->scbarray = - (struct scb *)malloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, - M_DEVBUF, M_NOWAIT); + scb_data->scbarray = malloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, + M_DEVBUF, M_NOWAIT | M_ZERO); if (scb_data->scbarray == NULL) return (ENOMEM); - memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC); /* Determine the number of hardware SCBs and initialize them */ @@ -4418,11 +4413,10 @@ ahc_alloc_scbs(struct ahc_softc *ahc) int error; if (sizeof(*pdata) > 0) { - pdata = (struct scb_platform_data *) - malloc(sizeof(*pdata), M_DEVBUF, M_NOWAIT); + pdata = malloc(sizeof(*pdata), M_DEVBUF, + M_NOWAIT | M_ZERO); if (pdata == NULL) break; - bzero(pdata, sizeof(*pdata)); } next_scb->platform_data = pdata; @@ -6877,14 +6871,13 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) return; } } - lstate = malloc(sizeof(*lstate), M_DEVBUF, M_NOWAIT); + lstate = malloc(sizeof(*lstate), M_DEVBUF, M_NOWAIT | M_ZERO); if (lstate == NULL) { xpt_print_path(ccb->ccb_h.path); printf("Couldn't allocate lstate\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; return; } - memset(lstate, 0, sizeof(*lstate)); status = xpt_create_path(&lstate->path, /*periph*/NULL, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c index 1d1a19ea376..140489b1241 100644 --- a/sys/dev/ic/aic7xxx_openbsd.c +++ b/sys/dev/ic/aic7xxx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.c,v 1.35 2007/08/04 14:37:34 krw Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.c,v 1.36 2007/09/07 17:58:39 krw Exp $ */ /* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -699,10 +699,9 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) { if (sizeof(struct ahc_platform_data) > 0) { ahc->platform_data = malloc(sizeof(struct ahc_platform_data), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_NOWAIT | M_ZERO); if (ahc->platform_data == NULL) return (ENOMEM); - bzero(ahc->platform_data, sizeof(struct ahc_platform_data)); } return (0); |