cfi_mtd: Fix bug in last sector detection