Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Fri, 29 May 2020 10:54:31 +0200: > On Fri, 29 May 2020 01:16:12 +0200 > Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > > > > > @@ -947,7 +949,8 @@ static int nand_reset_interface(struct nand_chip *chip, int chipnr) > > */ > > static int nand_setup_interface(struct nand_chip *chip, int chipnr) > > { > > - u8 mode = chip->interface_config.timings.mode; > > + const struct nand_controller_ops *ops = chip->controller->ops; > > + u8 mode = chip->best_interface_config->timings.mode; > > I didn't check, but I assume it's safe to dereference > ->best_interface_config here (IOW, ->best_interface_config is > guaranteed to be != NULL). Yes it's safe. ->best_interface_config is always set, even with mode 0 configuration. > > > u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = { mode, }; > > int ret; > > > > > > > /** > > @@ -2523,8 +2542,8 @@ int nand_reset(struct nand_chip *chip, int chipnr) > > * nand_setup_interface() uses ->set/get_features() which would > > * fail anyway as the parameter page is not available yet. > > */ > > - if (!memcmp(&chip->interface_config, nand_get_reset_interface(), > > - sizeof(chip->interface_config))) > > + if (!chip->best_interface_config || > > + chip->best_interface_config == nand_get_reset_interface()) > > I think 'chip->best_interface_config == nand_get_reset_interface()' is > never true. Oh right. I'll drop this, and we'll accept to sometimes call nand_setup_interface() to apply timings mode 0 while they are already applied. I don't think it's a big deal. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/