flash/nor: consolidate flash protect/protect_check
[fw/openocd] / src / flash / nor / cfi.c
index 0ae72d4a28be45756f8f122e8ea6d5552099577b..a2db50f3322fde08d958cded4fa499db99cf9520 100644 (file)
@@ -1098,11 +1098,6 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last)
                return ERROR_TARGET_NOT_HALTED;
        }
 
-       if ((first < 0) || (last < first) || (last >= bank->num_sectors)) {
-               LOG_ERROR("Invalid sector range");
-               return ERROR_FLASH_SECTOR_INVALID;
-       }
-
        if (cfi_info->qry[0] != 'Q')
                return ERROR_FLASH_BANK_NOT_PROBED;