extern int qla82xx_pinit_from_rom(scsi_qla_host_t *);
 extern int qla82xx_load_firmware(scsi_qla_host_t *);
 extern int qla82xx_reset_hw(scsi_qla_host_t *);
-extern int qla82xx_load_risc_blob(scsi_qla_host_t *, uint32_t *);
 extern void qla82xx_watchdog(scsi_qla_host_t *);
 
 /* Firmware and flash related functions */
 
                rval = ha->isp_ops->load_risc(vha, &srisc_address);
                if (rval == QLA_SUCCESS)
                        goto enable_82xx_npiv;
+               else
+                       goto failed;
        }
 
        if (!IS_FWI2_CAPABLE(ha) && !IS_QLA2100(ha) && !IS_QLA2200(ha)) {
 
        struct srb_iocb *lio = ctx->u.iocb_cmd;
        uint16_t opts;
 
-       mbx->entry_type = MBX_IOCB_TYPE;;
+       mbx->entry_type = MBX_IOCB_TYPE;
        SET_TARGET_ID(ha, mbx->loop_id, sp->fcport->loop_id);
        mbx->mb0 = cpu_to_le16(MBC_LOGIN_FABRIC_PORT);
        opts = lio->u.logio.flags & SRB_LOGIN_COND_PLOGI ? BIT_0 : 0;
 {
        struct qla_hw_data *ha = sp->fcport->vha->hw;
 
-       mbx->entry_type = MBX_IOCB_TYPE;;
+       mbx->entry_type = MBX_IOCB_TYPE;
        SET_TARGET_ID(ha, mbx->loop_id, sp->fcport->loop_id);
        mbx->mb0 = cpu_to_le16(MBC_LOGOUT_FABRIC_PORT);
        mbx->mb1 = HAS_EXTENDED_IDS(ha) ?
 
        /* Disable the board */
        qla_printk(KERN_INFO, ha, "Disabling the board\n");
 
+       qla82xx_idc_lock(ha);
+       qla82xx_clear_drv_active(ha);
+       qla82xx_idc_unlock(ha);
+
        /* Set DEV_FAILED flag to disable timer */
        vha->device_flags |= DFLG_DEV_FAILED;
        qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16);
 
 /* Driver Coexistence Defines */
 #define QLA82XX_CRB_DRV_ACTIVE      (QLA82XX_CAM_RAM(0x138))
 #define QLA82XX_CRB_DEV_STATE       (QLA82XX_CAM_RAM(0x140))
-#define QLA82XX_CRB_DEV_PART_INFO    (QLA82XX_CAM_RAM(0x14c))
-#define QLA82XX_CRB_DRV_IDC_VERSION  (QLA82XX_CAM_RAM(0x174))
 #define QLA82XX_CRB_DRV_STATE       (QLA82XX_CAM_RAM(0x144))
 #define QLA82XX_CRB_DRV_SCRATCH      (QLA82XX_CAM_RAM(0x148))
 #define QLA82XX_CRB_DEV_PART_INFO    (QLA82XX_CAM_RAM(0x14c))
+#define QLA82XX_CRB_DRV_IDC_VERSION  (QLA82XX_CAM_RAM(0x174))
 
 /* Every driver should use these Device State */
 #define QLA82XX_DEV_COLD               1
 
        scsi_host_put(base_vha->host);
 
        if (IS_QLA82XX(ha)) {
+               qla82xx_idc_lock(ha);
+               qla82xx_clear_drv_active(ha);
+               qla82xx_idc_unlock(ha);
+
                iounmap((device_reg_t __iomem *)ha->nx_pcibase);
                if (!ql2xdbwr)
                        iounmap((device_reg_t __iomem *)ha->nxdb_wr_ptr);