On Thu, 1 Apr 2021 15:48:12 +0530 Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> wrote: > static int nand_isbad_bbm(struct nand_chip *chip, loff_t ofs) > { > + struct mtd_info *mtd = nand_to_mtd(chip); > + int last_page = ((mtd->erasesize - mtd->writesize) >> > + chip->page_shift) & chip->pagemask; > int ret; > > if (chip->options & NAND_NO_BBM_QUIRK) > return 0; > > /* Check if the region is secured */ > - ret = nand_check_secure_region(chip, ofs, 0); > + ret = nand_check_secure_region(chip, ofs, last_page); or just: ret = nand_check_secure_region(chip, ofs, mtd->erasesize); > if (ret) > return ret; > > > */ > >