Skip to content

Commit 18f6261

Browse files
xdarklightmiquelraynal
authored andcommitted
mtd: rawnand: intel: check the mtd name only after setting the variable
Move the check for mtd->name after the mtd variable has actually been initialized. While here, also drop the NULL assignment to the mtd variable as it's overwritten later on anyways and the NULL value is never read. Fixes: 0b1039f ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210106140943.98072-1-martin.blumenstingl@googlemail.com
1 parent 3c97be6 commit 18f6261

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/mtd/nand/raw/intel-nand-controller.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
579579
struct device *dev = &pdev->dev;
580580
struct ebu_nand_controller *ebu_host;
581581
struct nand_chip *nand;
582-
struct mtd_info *mtd = NULL;
582+
struct mtd_info *mtd;
583583
struct resource *res;
584584
char *resname;
585585
int ret;
@@ -647,12 +647,13 @@ static int ebu_nand_probe(struct platform_device *pdev)
647647
ebu_host->ebu + EBU_ADDR_SEL(cs));
648648

649649
nand_set_flash_node(&ebu_host->chip, dev->of_node);
650+
651+
mtd = nand_to_mtd(&ebu_host->chip);
650652
if (!mtd->name) {
651653
dev_err(ebu_host->dev, "NAND label property is mandatory\n");
652654
return -EINVAL;
653655
}
654656

655-
mtd = nand_to_mtd(&ebu_host->chip);
656657
mtd->dev.parent = dev;
657658
ebu_host->dev = dev;
658659

0 commit comments

Comments
 (0)