diff options
author | jan <jan@cvs.openbsd.org> | 2019-05-14 15:19:07 +0000 |
---|---|---|
committer | jan <jan@cvs.openbsd.org> | 2019-05-14 15:19:07 +0000 |
commit | 60c3c68cf31cebda0c1b90a7d98180b21a5eda15 (patch) | |
tree | 579432d65f00b76147178312bd30c6100ae2fecd /sys | |
parent | c3b1db24b0d08a697401d940d7d3abdc43db8f69 (diff) |
Add free(9) sizes to ahc(4)
From Miod
OK tedu@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/aic7xxx.c | 30 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx_seeprom.c | 6 |
2 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index 7602339a9ed..d74d51bc4df 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx.c,v 1.93 2017/12/12 12:33:36 krw Exp $ */ +/* $OpenBSD: aic7xxx.c,v 1.94 2019/05/14 15:19:06 jan 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.93 2017/12/12 12:33:36 krw Exp $ + * $Id: aic7xxx.c,v 1.94 2019/05/14 15:19:06 jan Exp $ */ /* * Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003 @@ -1688,7 +1688,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel, int force) scsi_id += 8; tstate = ahc->enabled_targets[scsi_id]; if (tstate != NULL) - free(tstate, M_DEVBUF, 0); + free(tstate, M_DEVBUF, sizeof(*tstate)); ahc->enabled_targets[scsi_id] = NULL; } #endif @@ -3957,8 +3957,6 @@ ahc_set_unit(struct ahc_softc *ahc, int unit) void ahc_set_name(struct ahc_softc *ahc, char *name) { - if (ahc->name != NULL) - free(ahc->name, M_DEVBUF, 0); ahc->name = name; } @@ -3997,21 +3995,21 @@ ahc_free(struct ahc_softc *ahc) lstate = tstate->enabled_luns[j]; if (lstate != NULL) { /*xpt_free_path(lstate->path);*/ - free(lstate, M_DEVBUF, 0); + free(lstate, M_DEVBUF, sizeof(*lstate)); } } #endif - free(tstate, M_DEVBUF, 0); + free(tstate, M_DEVBUF, sizeof(*tstate)); } } #ifdef AHC_TARGET_MODE if (ahc->black_hole != NULL) { /*xpt_free_path(ahc->black_hole->path);*/ - free(ahc->black_hole, M_DEVBUF, 0); + free(ahc->black_hole, M_DEVBUF, sizeof(*ahc->black_hole)); } #endif if (ahc->seep_config != NULL) - free(ahc->seep_config, M_DEVBUF, 0); + free(ahc->seep_config, M_DEVBUF, sizeof(*ahc->seep_config)); return; } @@ -4329,7 +4327,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc) ahc_freedmamem(ahc->parent_dmat, PAGE_SIZE, sg_map->sg_dmamap, (caddr_t)sg_map->sg_vaddr, &sg_map->sg_dmasegs, sg_map->sg_nseg); - free(sg_map, M_DEVBUF, 0); + free(sg_map, M_DEVBUF, sizeof(*sg_map)); } } /*FALLTHROUGH*/ @@ -4350,8 +4348,10 @@ ahc_fini_scbdata(struct ahc_softc *ahc) case 0: break; } - if (scb_data->scbarray != NULL) - free(scb_data->scbarray, M_DEVBUF, 0); + if (scb_data->scbarray != NULL) { + free(scb_data->scbarray, M_DEVBUF, + AHC_SCB_MAX_ALLOC * sizeof(struct scb)); + } } void @@ -4383,7 +4383,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) (caddr_t *)&sg_map->sg_vaddr, &sg_map->sg_physaddr, &sg_map->sg_dmasegs, &sg_map->sg_nseg, ahc_name(ahc), "SG space") < 0) { - free(sg_map, M_DEVBUF, 0); + free(sg_map, M_DEVBUF, sizeof(*sg_map)); return; } @@ -6859,7 +6859,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) xpt_path_target_id(ccb->ccb_h.path), xpt_path_lun_id(ccb->ccb_h.path)); if (status != CAM_REQ_CMP) { - free(lstate, M_DEVBUF, 0); + free(lstate, M_DEVBUF, sizeof(*lstate)); xpt_print_path(ccb->ccb_h.path); printf("Couldn't allocate path\n"); ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -6980,7 +6980,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) xpt_print_path(ccb->ccb_h.path); printf("Target mode disabled\n"); xpt_free_path(lstate->path); - free(lstate, M_DEVBUF, 0); + free(lstate, M_DEVBUF, sizeof(*lstate)); ahc_pause(ahc); /* Can we clean up the target too? */ diff --git a/sys/dev/ic/aic7xxx_seeprom.c b/sys/dev/ic/aic7xxx_seeprom.c index 39128612eaf..5370ca3075a 100644 --- a/sys/dev/ic/aic7xxx_seeprom.c +++ b/sys/dev/ic/aic7xxx_seeprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_seeprom.c,v 1.7 2015/07/17 21:42:49 krw Exp $ */ +/* $OpenBSD: aic7xxx_seeprom.c,v 1.8 2019/05/14 15:19:06 jan Exp $ */ /* $NetBSD: aic7xxx_seeprom.c,v 1.8 2003/05/02 19:12:19 dyoung Exp $ */ /* @@ -47,7 +47,7 @@ * from the FreeBSD source file aic7xxx_pci.c by Frank van der Linden * <fvdl@netbsd.org> * - * $Id: aic7xxx_seeprom.c,v 1.7 2015/07/17 21:42:49 krw Exp $ + * $Id: aic7xxx_seeprom.c,v 1.8 2019/05/14 15:19:06 jan Exp $ * * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_pci.c,v 1.22 2003/01/20 20:44:55 gibbs Exp $ */ @@ -195,7 +195,7 @@ ahc_check_extport(struct ahc_softc *ahc, u_int *sxfrctl1) if (bootverbose) printf("%s: No SEEPROM available.\n", ahc_name(ahc)); ahc->flags |= AHC_USEDEFAULTS | AHC_NO_BIOS_INIT; - free(ahc->seep_config, M_DEVBUF, 0); + free(ahc->seep_config, M_DEVBUF, sizeof(*ahc->seep_config)); ahc->seep_config = NULL; sc = NULL; } else { |