diff options
Diffstat (limited to 'drivers/mtd')
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 6 | ||||
| -rw-r--r-- | drivers/mtd/devices/mtd_intel_dg.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/maps/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/mtd/maps/map_funcs.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/mtdoops.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/mtdpart.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/mtdswap.c | 1 | ||||
| -rw-r--r-- | drivers/mtd/nand/raw/mpc5121_nfc.c | 39 | ||||
| -rw-r--r-- | drivers/mtd/parsers/afs.c | 7 |
9 files changed, 33 insertions, 31 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index b73596a8e021..6049ba2d6bcb 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -2565,6 +2565,12 @@ static int cfi_intelext_suspend(struct mtd_info *mtd) ret = -EAGAIN; break; case FL_PM_SUSPENDED: + case FL_SHUTDOWN: + /* + * Already suspended, or put into array mode by the + * reboot notifier ahead of an imminent power-off. + * Either way there is nothing to do. + */ break; } mutex_unlock(&chip->mutex); diff --git a/drivers/mtd/devices/mtd_intel_dg.c b/drivers/mtd/devices/mtd_intel_dg.c index f2fa8f68d190..a566e86eb5e3 100644 --- a/drivers/mtd/devices/mtd_intel_dg.c +++ b/drivers/mtd/devices/mtd_intel_dg.c @@ -780,7 +780,7 @@ static int intel_dg_mtd_probe(struct auxiliary_device *aux_dev, dev_name(&aux_dev->dev), invm->regions[i].name); if (!name) { ret = -ENOMEM; - goto err; + goto err_norpm; } nvm->regions[n].name = name; diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index f447902d707e..1bb3dba2631d 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -101,7 +101,6 @@ config MTD_PHYSMAP_IXP4XX depends on MTD_PHYSMAP_OF depends on ARM select MTD_COMPLEX_MAPPINGS - select MTD_CFI_BE_BYTE_SWAP if CPU_BIG_ENDIAN default ARCH_IXP4XX help This provides some extra DT physmap parsing for the Intel IXP4xx diff --git a/drivers/mtd/maps/map_funcs.c b/drivers/mtd/maps/map_funcs.c index 1a4add9e119a..b0054933cae0 100644 --- a/drivers/mtd/maps/map_funcs.c +++ b/drivers/mtd/maps/map_funcs.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS + * Out-of-line map I/O functions for simple maps when CONFIG_MTD_COMPLEX_MAPPINGS * is enabled. */ diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 39df7ce8f55f..1da7ef06a7a9 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c @@ -392,6 +392,9 @@ static void mtdoops_notify_remove(struct mtd_info *mtd) cxt->mtd = NULL; flush_work(&cxt->work_erase); flush_work(&cxt->work_write); + vfree(cxt->oops_page_used); + cxt->oops_page_used = NULL; + cxt->oops_pages = 0; } diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 4b41550fd374..ddded0dbe77e 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -258,7 +258,8 @@ int mtd_add_partition(struct mtd_info *parent, const char *name, /* the direct offset is expected */ if (offset == MTDPART_OFS_APPEND || - offset == MTDPART_OFS_NXTBLK) + offset == MTDPART_OFS_NXTBLK || + offset == MTDPART_OFS_RETAIN) return -EINVAL; if (length == MTDPART_SIZ_FULL) diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index f33f753f0a9f..92e38ece8931 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c @@ -1452,6 +1452,7 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) debugfs_failed: del_mtd_blktrans_dev(mbd_dev); + mbd_dev = NULL; cleanup: mtdswap_cleanup(d); diff --git a/drivers/mtd/nand/raw/mpc5121_nfc.c b/drivers/mtd/nand/raw/mpc5121_nfc.c index 97b4e7f3e1bb..e6594548b7e0 100644 --- a/drivers/mtd/nand/raw/mpc5121_nfc.c +++ b/drivers/mtd/nand/raw/mpc5121_nfc.c @@ -23,7 +23,6 @@ #include <linux/mtd/partitions.h> #include <linux/of.h> #include <linux/of_address.h> -#include <linux/of_irq.h> #include <linux/platform_device.h> #include <asm/mpc5121.h> @@ -618,14 +617,14 @@ static int mpc5121_nfc_probe(struct platform_device *op) struct clk *clk; struct device *dev = &op->dev; struct mpc5121_nfc_prv *prv; - struct resource res; struct mtd_info *mtd; struct nand_chip *chip; - unsigned long regs_paddr, regs_size; const __be32 *chips_no; + void __iomem *regs; int resettime = 0; int retval = 0; int rev, len; + int irq; /* * Check SoC revision. This driver supports only NFC @@ -637,6 +636,14 @@ static int mpc5121_nfc_probe(struct platform_device *op) return -ENXIO; } + regs = devm_platform_ioremap_resource(op, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + irq = platform_get_irq(op, 0); + if (irq < 0) + return irq; + prv = devm_kzalloc(dev, sizeof(*prv), GFP_KERNEL); if (!prv) return -ENOMEM; @@ -660,17 +667,7 @@ static int mpc5121_nfc_probe(struct platform_device *op) return retval; } - prv->irq = irq_of_parse_and_map(dn, 0); - if (!prv->irq) { - dev_err(dev, "Error mapping IRQ!\n"); - return -EINVAL; - } - - retval = of_address_to_resource(dn, 0, &res); - if (retval) { - dev_err(dev, "Error parsing memory region!\n"); - return retval; - } + prv->irq = irq; chips_no = of_get_property(dn, "chips", &len); if (!chips_no || len != sizeof(*chips_no)) { @@ -678,19 +675,7 @@ static int mpc5121_nfc_probe(struct platform_device *op) return -EINVAL; } - regs_paddr = res.start; - regs_size = resource_size(&res); - - if (!devm_request_mem_region(dev, regs_paddr, regs_size, DRV_NAME)) { - dev_err(dev, "Error requesting memory region!\n"); - return -EBUSY; - } - - prv->regs = devm_ioremap(dev, regs_paddr, regs_size); - if (!prv->regs) { - dev_err(dev, "Error mapping memory region!\n"); - return -ENOMEM; - } + prv->regs = regs; mtd->name = "MPC5121 NAND"; chip->legacy.dev_ready = mpc5121_nfc_dev_ready; diff --git a/drivers/mtd/parsers/afs.c b/drivers/mtd/parsers/afs.c index 26116694c821..7ab3d50f565e 100644 --- a/drivers/mtd/parsers/afs.c +++ b/drivers/mtd/parsers/afs.c @@ -235,6 +235,9 @@ static int afs_parse_v2_partition(struct mtd_info *mtd, pr_debug("Parsing v2 partition @%08x-%08x\n", off, off + mtd->erasesize); + if (mtd->erasesize < sizeof(footer)) + return -EINVAL; + /* First read the footer */ ptr = off + mtd->erasesize - sizeof(footer); ret = mtd_read(mtd, ptr, sizeof(footer), &sz, (u_char *)footer); @@ -245,6 +248,8 @@ static int afs_parse_v2_partition(struct mtd_info *mtd, } name = (char *) &footer[0]; version = footer[9]; + if (footer[8] > mtd->erasesize - sizeof(footer)) + return -EINVAL; ptr = off + mtd->erasesize - sizeof(footer) - footer[8]; pr_debug("found image \"%s\", version %08x, info @%08x\n", @@ -278,6 +283,8 @@ static int afs_parse_v2_partition(struct mtd_info *mtd, entrypoint = imginfo[pad]; attributes = imginfo[pad+1]; region_count = imginfo[pad+2]; + if (region_count > (ARRAY_SIZE(imginfo) - pad - 3) / 4) + return -EINVAL; block_start = imginfo[20]; block_end = imginfo[21]; |
