Print this page
*** NO COMMENTS ***
        
@@ -734,49 +734,44 @@
                         goto fail_attach;
                 }
 
                 /* Initialize all Mutex */
                 INIT_LIST_HEAD(&instance->completed_pool_list);
-                mutex_init(&instance->completed_pool_mtx,
-                    "completed_pool_mtx", MUTEX_DRIVER,
-                    DDI_INTR_PRI(instance->intr_pri));
+                mutex_init(&instance->completed_pool_mtx, NULL,
+                    MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->sync_map_mtx,
-                    "sync_map_mtx", MUTEX_DRIVER,
-                    DDI_INTR_PRI(instance->intr_pri));
+                mutex_init(&instance->sync_map_mtx, NULL,
+                    MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->app_cmd_pool_mtx,
-                    "app_cmd_pool_mtx", MUTEX_DRIVER,
-                    DDI_INTR_PRI(instance->intr_pri));
+                mutex_init(&instance->app_cmd_pool_mtx, NULL,
+                    MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->config_dev_mtx, "config_dev_mtx",
+                mutex_init(&instance->config_dev_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->cmd_pend_mtx, "cmd_pend_mtx",
+                mutex_init(&instance->cmd_pend_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->ocr_flags_mtx, "ocr_flags_mtx",
+                mutex_init(&instance->ocr_flags_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->int_cmd_mtx, "int_cmd_mtx",
+                mutex_init(&instance->int_cmd_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
                 cv_init(&instance->int_cmd_cv, NULL, CV_DRIVER, NULL);
 
-                mutex_init(&instance->cmd_pool_mtx, "cmd_pool_mtx",
+                mutex_init(&instance->cmd_pool_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                mutex_init(&instance->reg_write_mtx, "reg_write_mtx",
+                mutex_init(&instance->reg_write_mtx, NULL,
                     MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
                 if (instance->tbolt) {
-                        mutex_init(&instance->cmd_app_pool_mtx,
-                            "cmd_app_pool_mtx", MUTEX_DRIVER,
-                            DDI_INTR_PRI(instance->intr_pri));
+                        mutex_init(&instance->cmd_app_pool_mtx, NULL,
+                            MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
-                        mutex_init(&instance->chip_mtx,
-                            "chip_mtx", MUTEX_DRIVER,
-                            DDI_INTR_PRI(instance->intr_pri));
+                        mutex_init(&instance->chip_mtx, NULL,
+                            MUTEX_DRIVER, DDI_INTR_PRI(instance->intr_pri));
 
                 }
 
                 instance->unroll.mutexs = 1;
 
@@ -940,15 +935,10 @@
                 }
 
                 instance->mr_ld_list =
                     kmem_zalloc(MRDRV_MAX_LD * sizeof (struct mrsas_ld),
                     KM_SLEEP);
-                if (instance->mr_ld_list == NULL) {
-                        cmn_err(CE_WARN, "mr_sas attach(): "
-                            "failed to allocate ld_list array");
-                        goto fail_attach;
-                }
                 instance->unroll.ldlist_buff = 1;
 
 #ifdef PDSUPPORT
                 if (instance->tbolt) {
                         instance->mr_tbolt_pd_max = MRSAS_TBOLT_PD_TGT_MAX;
@@ -1443,16 +1433,11 @@
                 return (ENXIO);
         }
 
         ioctl = (struct mrsas_ioctl *)kmem_zalloc(sizeof (struct mrsas_ioctl),
             KM_SLEEP);
-        if (ioctl == NULL) {
-                /* Failed to allocate memory for ioctl  */
-                con_log(CL_ANN, (CE_WARN, "mr_sas_ioctl: "
-                    "failed to allocate memory for ioctl"));
-                return (ENOMEM);
-        }
+        ASSERT(ioctl);
 
         switch ((uint_t)cmd) {
                 case MRSAS_IOCTL_FIRMWARE:
                         if (ddi_copyin((void *)arg, ioctl,
                             sizeof (struct mrsas_ioctl), mode)) {
@@ -1475,13 +1460,10 @@
                                 rval = 1;
                         }
 
                         break;
                 case MRSAS_IOCTL_AEN:
-                        con_log(CL_ANN,
-                            (CE_NOTE, "mrsas_ioctl: IOCTL Register AEN.\n"));
-
                         if (ddi_copyin((void *) arg, &aen,
                             sizeof (struct mrsas_aen), mode)) {
                                 con_log(CL_ANN, (CE_WARN,
                                     "mrsas_ioctl: ERROR AEN copyin"));
                                 kmem_free(ioctl, sizeof (struct mrsas_ioctl));
@@ -3197,26 +3179,18 @@
          * instance->cmd_list is an array of struct mrsas_cmd pointers.
          * Allocate the dynamic array first and then allocate individual
          * commands.
          */
         instance->cmd_list = kmem_zalloc(sz, KM_SLEEP);
-        if (instance->cmd_list == NULL) {
-                con_log(CL_NONE, (CE_WARN,
-                    "Failed to allocate memory for cmd_list"));
-                return (DDI_FAILURE);
-        }
+        ASSERT(instance->cmd_list);
 
         /* create a frame pool and assign one frame to each cmd */
         for (count = 0; count < max_cmd; count++) {
                 instance->cmd_list[count] =
                     kmem_zalloc(sizeof (struct mrsas_cmd), KM_SLEEP);
-                if (instance->cmd_list[count] == NULL) {
-                        con_log(CL_NONE, (CE_WARN,
-                            "Failed to allocate memory for mrsas_cmd"));
-                        goto mrsas_undo_cmds;
+                ASSERT(instance->cmd_list[count]);
                 }
-        }
 
         /* add all the commands to command pool */
 
         INIT_LIST_HEAD(&instance->cmd_pool_list);
         INIT_LIST_HEAD(&instance->cmd_pend_list);
@@ -3728,18 +3702,12 @@
         } else {
                 instance->max_sectors_per_req = instance->max_num_sge *
                     PAGESIZE / 512;
         }
 
-        if (ctrl_info.properties.on_off_properties & DISABLE_OCR_PROP_FLAG) {
+        if (ctrl_info.properties.on_off_properties & DISABLE_OCR_PROP_FLAG)
                 instance->disable_online_ctrl_reset = 1;
-                con_log(CL_ANN1,
-                    (CE_NOTE, "Disable online control Flag is set\n"));
-        } else {
-                con_log(CL_ANN1,
-                    (CE_NOTE, "Disable online control Flag is not set\n"));
-        }
 
         return (DDI_SUCCESS);
 
 }
 
@@ -4018,11 +3986,11 @@
                  */
                 WR_IB_DOORBELL(0xF, instance);
         }
 
         if (mrsas_check_acc_handle(instance->regmap_handle) != DDI_SUCCESS) {
-                return (ENODEV);
+                return (EIO);
         }
 
         return (DDI_SUCCESS);
 }
 
@@ -4876,11 +4844,10 @@
  * mrsas_free_dma_obj(struct mrsas_instance *, dma_obj_t)
  *
  * De-allocate the memory and other resources for an dma object, which must
  * have been alloated by a previous call to mrsas_alloc_dma_obj()
  */
-/* ARGSUSED */
 int
 mrsas_free_dma_obj(struct mrsas_instance *instance, dma_obj_t obj)
 {
 
         if ((obj.dma_handle == NULL) || (obj.acc_handle == NULL)) {
@@ -5590,11 +5557,11 @@
                                 con_log(CL_ANN, (CE_WARN,
                                     "issue_mfi_pthru : "
                                     "copy to user space failed"));
                         }
                         con_log(CL_DLEVEL1, (CE_WARN,
-                            "Copying Sense info sense_buff[%d] = 0x%X\n",
+                            "Copying Sense info sense_buff[%d] = 0x%X",
                             i, *((uint8_t *)cmd->sense + i)));
                 }
         }
         (void) ddi_dma_sync(cmd->frame_dma_obj.dma_handle, 0, 0,
             DDI_DMA_SYNC_FORDEV);
@@ -5627,12 +5594,12 @@
         int i;
         dcmd = &cmd->frame->dcmd;
         kdcmd = (struct mrsas_dcmd_frame *)&ioctl->frame[0];
 
         if (instance->adapterresetinprogress) {
-                con_log(CL_ANN1, (CE_WARN, "Reset flag set, "
-                "returning mfi_pkt and setting TRAN_BUSY\n"));
+                con_log(CL_ANN1, (CE_NOTE, "Reset flag set, "
+                "returning mfi_pkt and setting TRAN_BUSY"));
                 return (DDI_FAILURE);
         }
         model = ddi_model_convert_from(mode & FMODELS);
         if (model == DDI_MODEL_ILP32) {
                 con_log(CL_ANN1, (CE_CONT, "issue_mfi_dcmd: DDI_MODEL_ILP32"));
@@ -7039,11 +7006,11 @@
         while (!(status & DIAG_WRITE_ENABLE)) {
                 delay(100 * drv_usectohz(MILLISEC));
                 status = RD_OB_DRWE(instance);
                 if (retry++ == 100) {
                         cmn_err(CE_WARN, "mrsas_reset_ppc: DRWE bit "
-                            "check retry count %d\n", retry);
+                            "check retry count %d", retry);
                         return (DDI_FAILURE);
                 }
         }
         WR_IB_DRWE(status | DIAG_RESET_ADAPTER, instance);
         delay(100 * drv_usectohz(MILLISEC));
@@ -7051,11 +7018,11 @@
         while (status & DIAG_RESET_ADAPTER) {
                 delay(100 * drv_usectohz(MILLISEC));
                 status = RD_OB_DRWE(instance);
                 if (retry++ == 100) {
                         cmn_err(CE_WARN, "mrsas_reset_ppc: "
-                            "RESET FAILED. KILL adapter called\n.");
+                            "RESET FAILED. KILL adapter called.");
 
                         (void) mrsas_kill_adapter(instance);
                         return (DDI_FAILURE);
                 }
         }
@@ -7378,16 +7345,11 @@
          * only one interrupt. The framework can be extended later.
          */
         instance->intr_htable_size = count * sizeof (ddi_intr_handle_t);
         instance->intr_htable = kmem_zalloc(instance->intr_htable_size,
             KM_SLEEP);
-        if (instance->intr_htable == NULL) {
-                con_log(CL_ANN, (CE_WARN, "mrsas_add_intrs: "
-                    "failed to allocate memory for intr-handle table"));
-                instance->intr_htable_size = 0;
-                return (DDI_FAILURE);
-        }
+        ASSERT(instance->intr_htable);
 
         flag = ((intr_type == DDI_INTR_TYPE_MSI) ||
             (intr_type == DDI_INTR_TYPE_MSIX)) ?
             DDI_INTR_ALLOC_STRICT : DDI_INTR_ALLOC_NORMAL;
 
@@ -7682,15 +7644,10 @@
                 }
                 return (NDI_SUCCESS);
         }
 
         sd = kmem_zalloc(sizeof (struct scsi_device), KM_SLEEP);
-        if (sd == NULL) {
-                con_log(CL_ANN1, (CE_WARN, "mrsas_config_ld: "
-                    "failed to allocate mem for scsi_device"));
-                return (NDI_FAILURE);
-        }
         sd->sd_address.a_hba_tran = instance->tran;
         sd->sd_address.a_target = (uint16_t)tgt;
         sd->sd_address.a_lun = (uint8_t)lun;
 
         if (scsi_hba_probe(sd, NULL) == SCSIPROBE_EXISTS)