2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-20 11:34:02 +08:00

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
This commit is contained in:
Christoph Hellwig 2021-08-23 09:33:53 +02:00 committed by Miquel Raynal
parent 799ae31c58
commit f214eebf8d

View File

@ -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,