--- old/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c	2014-10-23 11:04:55.899047566 -0400
+++ new/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c	2014-10-23 11:04:55.904291035 -0400
@@ -185,20 +185,11 @@
 	}
 
 	xp = kmem_zalloc(sizeof (ql_xioctl_t), KM_SLEEP);
-	if (xp == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		return (ENOMEM);
-	}
 	ha->xioctl = xp;
 
 	/* Allocate AEN tracking buffer */
 	xp->aen_tracking_queue = kmem_zalloc(EXT_DEF_MAX_AEN_QUEUE *
 	    sizeof (EXT_ASYNC_EVENT), KM_SLEEP);
-	if (xp->aen_tracking_queue == NULL) {
-		EL(ha, "failed, kmem_zalloc-2\n");
-		ql_free_xioctl_resource(ha);
-		return (ENOMEM);
-	}
 
 	QL_PRINT_9(CE_CONT, "(%d): done\n", ha->instance);
 
@@ -1530,12 +1521,6 @@
 	/* Allocate command block. */
 	pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_byte_cnt);
 	pkt = kmem_zalloc(pkt_size, KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 	pld = (caddr_t)pkt + sizeof (ql_mbx_iocb_t);
 
 	/* Get command payload data. */
@@ -2140,12 +2125,6 @@
 		pld_size = cmd->ResponseLen;
 		pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_size);
 		pkt = kmem_zalloc(pkt_size, KM_SLEEP);
-		if (pkt == NULL) {
-			EL(ha, "failed, kmem_zalloc\n");
-			cmd->Status = EXT_STATUS_NO_MEMORY;
-			cmd->ResponseLen = 0;
-			return;
-		}
 		pld = (caddr_t)pkt + sizeof (ql_mbx_iocb_t);
 
 		/* Get DMA memory for the IOCB */
@@ -2198,11 +2177,6 @@
 
 		pkt_size = sizeof (ql_mbx_iocb_t);
 		pkt = kmem_zalloc(pkt_size, KM_SLEEP);
-		if (pkt == NULL) {
-			EL(ha, "failed, kmem_zalloc-2\n");
-			cmd->Status = EXT_STATUS_NO_MEMORY;
-			return;
-		}
 		pld = NULL;
 		pld_size = 0;
 	}
@@ -3362,12 +3336,6 @@
 
 	/* Allocate command memory. */
 	bp = kmem_zalloc(plbreq.TransferCount, KM_SLEEP);
-	if (bp == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/* Get loopback data. */
 	if (ql_get_buffer_data((caddr_t)(uintptr_t)plbreq.BufferAddress,
@@ -3660,12 +3628,6 @@
 
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(SEND_RNID_RSP_SIZE, KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	if (local_hba) {
 		rval = ql_get_rnid_params(ha, SEND_RNID_RSP_SIZE, tmp_buf);
@@ -4031,10 +3993,6 @@
 
 	pkt_size = sizeof (ql_mbx_iocb_t) + sizeof (ql_rpt_lun_lst_t);
 	pkt = kmem_zalloc(pkt_size, KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		return (0);
-	}
 	rpt = (ql_rpt_lun_lst_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
 
 	/* Get DMA memory for the IOCB */
@@ -4275,10 +4233,6 @@
 
 	pkt_size = sizeof (ql_mbx_iocb_t) + INQ_DATA_SIZE;
 	pkt = kmem_zalloc(pkt_size, KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		return (0);
-	}
 	inq = (uint8_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
 
 	cnt = 0;
@@ -4698,10 +4652,7 @@
 		return (QL_FUNCTION_FAILED);
 	}
 
-	if ((fdesc = kmem_zalloc(sizeof (flash_desc_t), KM_SLEEP)) == NULL) {
-		EL(ha, "kmem_zalloc=null\n");
-		return (QL_MEMORY_ALLOC_FAILED);
-	}
+	fdesc = kmem_zalloc(sizeof (flash_desc_t), KM_SLEEP);
 	rval = ql_dump_fcode(ha, (uint8_t *)fdesc, sizeof (flash_desc_t),
 	    ha->flash_desc_addr << 2);
 	if (rval != QL_SUCCESS) {
@@ -5435,12 +5386,6 @@
 
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
 	    (caddr_t)tmp_buf);
@@ -5498,12 +5443,6 @@
 
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/* Send command */
 	rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
@@ -5635,12 +5574,6 @@
 
 	/* Allocate memory for command. */
 	ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
-	if (ls == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/*
 	 * I think these are supposed to be port statistics
@@ -5757,12 +5690,6 @@
 
 	/* Allocate memory for command. */
 	ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
-	if (ls == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	rval = ql_get_link_status(ha, tq->loop_id, sizeof (ql_link_stats_t),
 	    (caddr_t)ls, 0);
@@ -6972,10 +6899,7 @@
 
 	/* Process flash layout table header */
 	len = sizeof (ql_flt_ptr_t);
-	if ((bp = kmem_zalloc(len, KM_SLEEP)) == NULL) {
-		EL(ha, "kmem_zalloc=null\n");
-		return;
-	}
+	bp = kmem_zalloc(len, KM_SLEEP);
 
 	/* Process pointer to flash layout table */
 	if ((rval = ql_dump_fcode(ha, bp, len, flt_paddr)) != QL_SUCCESS) {
@@ -7032,10 +6956,7 @@
 	QL_PRINT_9(CE_CONT, "(%d): started faddr=%xh\n", ha->instance, faddr);
 
 	/* Process flash layout table header */
-	if ((bp = kmem_zalloc(FLASH_LAYOUT_TABLE_SIZE, KM_SLEEP)) == NULL) {
-		EL(ha, "kmem_zalloc=null\n");
-		return;
-	}
+	bp = kmem_zalloc(FLASH_LAYOUT_TABLE_SIZE, KM_SLEEP);
 	fhdr = (ql_flt_hdr_t *)bp;
 
 	/* Process flash layout table. */
@@ -7711,12 +7632,6 @@
 
 	/* Allocate payload buffer */
 	payload = kmem_zalloc(FWEXTSIZE, KM_SLEEP);
-	if (payload == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/* Sync DMA buffer. */
 	(void) ddi_dma_sync(ha->fwexttracebuf.dma_handle, 0,
@@ -7800,12 +7715,6 @@
 
 	/* Allocate payload buffer */
 	payload = kmem_zalloc(FWEXTSIZE, KM_SLEEP);
-	if (payload == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/* Sync DMA buffer. */
 	(void) ddi_dma_sync(ha->fwfcetracebuf.dma_handle, 0,
@@ -7922,10 +7831,6 @@
 	QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance);
 
 	ptr32 = kmem_zalloc(pci_size, KM_SLEEP);
-	if (ptr32 == NULL) {
-		EL(ha, "failed kmem_zalloc\n");
-		return (ENOMEM);
-	}
 
 	/* store the initial value of ptr32 */
 	org_ptr32 = ptr32;
@@ -8073,12 +7978,6 @@
 
 	/* Allocate packet. */
 	pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	pkt->mvfy.entry_type = VERIFY_MENLO_TYPE;
 	pkt->mvfy.entry_count = 1;
@@ -8188,14 +8087,6 @@
 		return;
 	}
 	pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		kmem_free(dma_mem, sizeof (dma_mem_t));
-		ql_restart_hba(ha);
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	/* Get DMA memory for the IOCB */
 	if (ql_get_dma_mem(ha, dma_mem, fw.TotalByteCount, LITTLE_ENDIAN_DMA,
@@ -8327,13 +8218,6 @@
 
 	/* Allocate packet. */
 	pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
-	if (pkt == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		ql_restart_driver(ha);
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	pkt->mdata.entry_type = MENLO_DATA_TYPE;
 	pkt->mdata.entry_count = 1;
@@ -8823,12 +8707,6 @@
 
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(EXT_DEF_DCBX_PARAM_BUF_SIZE, KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 	/* Send command */
 	rval = ql_get_dcbx_params(ha, EXT_DEF_DCBX_PARAM_BUF_SIZE,
 	    (caddr_t)tmp_buf);
@@ -9071,12 +8949,6 @@
 
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(size, KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 
 	if (!(info.Operation & MENLO_OP_GET_INFO)) {
 		EL(ha, "Invalid request for 81XX\n");
@@ -9154,12 +9026,6 @@
 	}
 	/* Allocate memory for command. */
 	tmp_buf = kmem_zalloc(fcf_list.BufSize, KM_SLEEP);
-	if (tmp_buf == NULL) {
-		EL(ha, "failed, kmem_zalloc\n");
-		cmd->Status = EXT_STATUS_NO_MEMORY;
-		cmd->ResponseLen = 0;
-		return;
-	}
 	/* build the descriptor */
 	if (fcf_list.Options) {
 		mb_fcf_list.options = FCF_LIST_RETURN_ONE;
