diff options
author | Christoph Hellwig <hch@lst.de> | 2021-08-23 09:33:53 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2021-08-23 10:01:01 +0200 |
commit | f214eebf8de4d2e412a35ff140687d88f056143a (patch) | |
tree | 8afe41b18da53106f96dd6a9a4de08ce5b9a74db /drivers/mtd/mtd_blkdevs.c | |
parent | 799ae31c58ae766a4ce9b198658b286ecaf2c575 (diff) | |
download | linux-f214eebf8de4d2e412a35ff140687d88f056143a.tar.gz linux-f214eebf8de4d2e412a35ff140687d88f056143a.tar.bz2 linux-f214eebf8de4d2e412a35ff140687d88f056143a.zip |
mtd_blkdevs: use lockdep_assert_held
Use lockdep_assert_held to ensure mtd_table_mutex is held instead of
mutex_trylock games.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210823073359.705281-3-hch@lst.de
Diffstat (limited to 'drivers/mtd/mtd_blkdevs.c')
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 94d42ba01b2f..5981fd026c87 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -310,10 +310,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) struct gendisk *gd; int ret; - if (mutex_trylock(&mtd_table_mutex)) { - mutex_unlock(&mtd_table_mutex); - BUG(); - } + lockdep_assert_held(&mtd_table_mutex); mutex_lock(&blktrans_ref_mutex); list_for_each_entry(d, &tr->devs, list) { @@ -443,10 +440,7 @@ int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old) { unsigned long flags; - if (mutex_trylock(&mtd_table_mutex)) { - mutex_unlock(&mtd_table_mutex); - BUG(); - } + lockdep_assert_held(&mtd_table_mutex); if (old->disk_attributes) sysfs_remove_group(&disk_to_dev(old->disk)->kobj, |