* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#134 $
*
* $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.c,v 1.41.2.27 2003/06/10 03:26:08 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.c,v 1.4 2004/02/13 01:04:14 joerg Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.c,v 1.5 2004/03/15 01:10:42 dillon Exp $
*/
#include "aic7xxx_osm.h"
&& 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);
- if (tstate == NULL)
- return (NULL);
+ tstate = malloc(sizeof(*tstate), M_DEVBUF, M_WAITOK);
/*
* If we have allocated a master tstate, copy user settings from
int i;
#if !defined(__DragonFly__) && !defined(__FreeBSD__)
- ahc = malloc(sizeof(*ahc), M_DEVBUF, M_NOWAIT);
- if (!ahc) {
- printf("aic7xxx: cannot malloc softc!\n");
- free(name, M_DEVBUF);
- return NULL;
- }
+ ahc = malloc(sizeof(*ahc), M_DEVBUF, M_WAITOK);
#else
ahc = device_get_softc((device_t)platform_arg);
#endif
memset(ahc, 0, sizeof(*ahc));
ahc->seep_config = malloc(sizeof(*ahc->seep_config),
- M_DEVBUF, M_NOWAIT);
- if (ahc->seep_config == NULL) {
-#if !defined(__DragonFly__) && !defined(__FreeBSD__)
- free(ahc, M_DEVBUF);
-#endif
- free(name, M_DEVBUF);
- return (NULL);
- }
+ M_DEVBUF, M_WAITOK);
LIST_INIT(&ahc->pending_scbs);
/* We don't know our unit number until the OSM sets it */
ahc->name = name;
/* 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);
- if (ahc->scb_data == NULL)
- return (ENOMEM);
- memset(ahc->scb_data, 0, sizeof(*ahc->scb_data));
+ M_DEVBUF, M_WAITOK | M_ZERO);
}
return (0);
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);
- if (scb_data->scbarray == NULL)
- return (ENOMEM);
- memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC);
+ scb_data->scbarray = malloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC,
+ M_DEVBUF, M_WAITOK | M_ZERO);
/* Determine the number of hardware SCBs and initialize them */
next_scb = &scb_data->scbarray[scb_data->numscbs];
- sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_NOWAIT);
-
- if (sg_map == NULL)
- return;
+ sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_WAITOK);
/* Allocate S/G space for the next batch of SCBS */
if (ahc_dmamem_alloc(ahc, scb_data->sg_dmat,
#ifndef __linux__
int error;
#endif
- pdata = (struct scb_platform_data *)malloc(sizeof(*pdata),
- M_DEVBUF, M_NOWAIT);
- if (pdata == NULL)
- break;
+ pdata = malloc(sizeof(*pdata), M_DEVBUF, M_WAITOK);
next_scb->platform_data = pdata;
next_scb->sg_map = sg_map;
next_scb->sg_list = segs;
ahc->num_critical_sections = cs_count;
if (cs_count != 0) {
-
cs_count *= sizeof(struct cs);
- ahc->critical_sections = malloc(cs_count, M_DEVBUF, M_NOWAIT);
- if (ahc->critical_sections == NULL)
- panic("ahc_loadseq: Could not malloc");
+ ahc->critical_sections = malloc(cs_count, M_DEVBUF, M_WAITOK);
memcpy(ahc->critical_sections, cs_table, cs_count);
}
ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE);
return;
}
}
- lstate = malloc(sizeof(*lstate), M_DEVBUF, M_NOWAIT);
- 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));
+ lstate = malloc(sizeof(*lstate), M_DEVBUF, M_WAITOK | M_ZERO);
status = xpt_create_path(&lstate->path, /*periph*/NULL,
xpt_path_path_id(ccb->ccb_h.path),
xpt_path_target_id(ccb->ccb_h.path),