OSDN Git Service

mtd: rawnand: atmel: Check the proposed data interface is supported
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 5 May 2021 21:37:31 +0000 (23:37 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 26 May 2021 08:43:35 +0000 (10:43 +0200)
Check the data interface is supported in ->setup_interface() before
acknowledging the timings.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210505213750.257417-4-miquel.raynal@bootlin.com
drivers/mtd/nand/raw/atmel/nand-controller.c

index 53b3a11..6e15f42 100644 (file)
@@ -1524,8 +1524,13 @@ static int atmel_nand_setup_interface(struct nand_chip *chip, int csline,
                                      const struct nand_interface_config *conf)
 {
        struct atmel_nand *nand = to_atmel_nand(chip);
+       const struct nand_sdr_timings *sdr;
        struct atmel_nand_controller *nc;
 
+       sdr = nand_get_sdr_timings(conf);
+       if (IS_ERR(sdr))
+               return PTR_ERR(sdr);
+
        nc = to_nand_controller(nand->base.controller);
 
        if (csline >= nand->numcs ||