diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-08-16 06:36:01 -1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-08-16 06:36:01 -1000 |
commit | a2824f19e6065a0d3735acd9fe7155b104e7edf5 (patch) | |
tree | 3f514882017d26da13cda226cb3f94eba6f26f04 /drivers/mtd/mtd_blkdevs.c | |
parent | b88bcc7d542c33ad3f5c042409d8ce0505cde1f8 (diff) | |
parent | b48027083a78b13356695555a05b0e085e378687 (diff) | |
download | linux-a2824f19e6065a0d3735acd9fe7155b104e7edf5.tar.gz linux-a2824f19e6065a0d3735acd9fe7155b104e7edf5.tar.bz2 linux-a2824f19e6065a0d3735acd9fe7155b104e7edf5.zip |
Merge tag 'mtd/fixes-for-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD fixes from Miquel Raynal:
"MTD core fixes:
- Fix lock hierarchy in deregister_mtd_blktrans
- Handle flashes without OTP gracefully
- Break circular locks in register_mtd_blktrans
MTD device fixes:
- mchp48l640:
- Fix memory leak on cmd
- Silence some uninitialized variable warnings
- blkdevs:
- Initialize rq.limits.discard_granularity
CFI fixes:
- Fix crash when erasing/writing AMD cards
Raw NAND fixes:
- Fix of_get_nand_secure_regions():
- Add a missing check
- Avoid an unwanted probe failure when a DT property is missing"
* tag 'mtd/fixes-for-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
mtd: rawnand: Fix probe failure due to of_get_nand_secure_regions()
mtd: fix lock hierarchy in deregister_mtd_blktrans
mtd: devices: mchp48l640: Fix memory leak on cmd
mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards
mtd: core: handle flashes without OTP gracefully
mtd: mchp48l640: silence some uninitialized variable warnings
mtd: break circular locks in register_mtd_blktrans
mtd: rawnand: Add a check in of_get_nand_secure_regions()
mtd: mtd_blkdevs: Initialize rq.limits.discard_granularity
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 6ce4bc57f919..44bea3f65060 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -419,6 +419,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) if (tr->discard) { blk_queue_flag_set(QUEUE_FLAG_DISCARD, new->rq); blk_queue_max_discard_sectors(new->rq, UINT_MAX); + new->rq->limits.discard_granularity = tr->blksize; } gd->queue = new->rq; @@ -525,14 +526,10 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) if (!blktrans_notifier.list.next) register_mtd_user(&blktrans_notifier); - - mutex_lock(&mtd_table_mutex); - ret = register_blkdev(tr->major, tr->name); if (ret < 0) { printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", tr->name, tr->major, ret); - mutex_unlock(&mtd_table_mutex); return ret; } @@ -542,12 +539,12 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) tr->blkshift = ffs(tr->blksize) - 1; INIT_LIST_HEAD(&tr->devs); - list_add(&tr->list, &blktrans_majors); + mutex_lock(&mtd_table_mutex); + list_add(&tr->list, &blktrans_majors); mtd_for_each_device(mtd) if (mtd->type != MTD_ABSENT) tr->add_mtd(tr, mtd); - mutex_unlock(&mtd_table_mutex); return 0; } @@ -564,8 +561,8 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) list_for_each_entry_safe(dev, next, &tr->devs, list) tr->remove_dev(dev); - unregister_blkdev(tr->major, tr->name); mutex_unlock(&mtd_table_mutex); + unregister_blkdev(tr->major, tr->name); BUG_ON(!list_empty(&tr->devs)); return 0; |