On Mon, Mar 08, 2021 at 07:04:17PM +0530, Manivannan Sadhasivam wrote: > On Mon, Mar 08, 2021 at 10:02:47AM +0100, Boris Brezillon wrote: > > On Mon, 8 Mar 2021 11:14:47 +0530 > > Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> wrote: > > > > [...] > > > > /* helper to configure address register values */ > > > -static void set_address(struct qcom_nand_host *host, u16 column, int page) > > > +static int set_address(struct qcom_nand_host *host, u16 column, int page) > > > { > > > struct nand_chip *chip = &host->chip; > > > struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); > > > + u32 offs = page << chip->page_shift; > > > + int i, j; > > > + > > > + /* Skip touching the secure regions if present */ > > > + for (i = 0, j = 0; i < host->nr_sec_regions; i++, j += 2) { > > > + if (offs >= host->sec_regions[j] && > > > + (offs <= host->sec_regions[j] + host->sec_regions[j + 1])) > > > + return -EIO; > > > + } > > > > Hm, not sure that's a good idea to make this check part of > > set_address(). Looks like set_address() can be used for ONFI page > > access too, and you definitely don't want to block those > > requests. I'd recommend having a separate helper that you can call from > > qcom_nandc_{read,write}_{oob,page,page_raw}(). > > > > Right but I went for the code simplicity :/ Anyway, since you're favoring > towards moving this check into code, I'll incorporate your suggestion s/code/core > accordingly. > > Thanks, > Mani