From the usages of function csio_hw_flash_erase_sectors() defined in drivers/scsi/csiostor/csio_hw.c, we can infer that it should return a non-zero error code when something goes wrong. However, it will return 0 even the calls to csio_hw_sf1_write() or csio_hw_flash_wait_op() fails. Maybe it is better to use "return ret;" instead of "return 0;" at line 616. Codes related to this bug are summarised as follows. csio_hw_flash_erase_sectors @@ drivers/scsi/csiostor/csio_hw.c 589 static int 590 csio_hw_flash_erase_sectors(struct csio_hw *hw, int32_t start, int32_t end) 591 { 592 int ret = 0; 593 594 while (start <= end) { 595 596 ret = csio_hw_sf1_write(hw, 1, 0, 1, SF_WR_ENABLE); 597 if (ret != 0) 598 goto out; 599 600 ret = csio_hw_sf1_write(hw, 4, 0, 1, 601 SF_ERASE_SECTOR | (start << 8)); 602 if (ret != 0) 603 goto out; 604 605 ret = csio_hw_flash_wait_op(hw, 14, 500); 606 if (ret != 0) 607 goto out; 608 609 start++; 610 } 611 out: 612 if (ret) 613 csio_err(hw, "erase of flash sector %d failed, error %d\n", 614 start, ret); 615 csio_wr_reg32(hw, 0, SF_OP_A); /* unlock SF */ 616 return 0; // return ret? 617 } csio_hw_fw_dload @@ drivers/scsi/csiostor/csio_hw.c 667 static int 668 csio_hw_fw_dload(struct csio_hw *hw, uint8_t *fw_data, uint32_t size) 669 { ... 719 ret = csio_hw_flash_erase_sectors(hw, FLASH_FW_START_SEC, 720 FLASH_FW_START_SEC + i - 1); 721 if (ret) { // check the return value of csio_hw_flash_erase_sectors() 722 csio_err(hw, "Flash Erase failed\n"); 723 goto out; 724 } ... 755 out: 756 if (ret) 757 csio_err(hw, "firmware download failed, error %d\n", ret); 758 return ret; 759 } Thanks very much!