aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sverdlin <alexander.sverdlin@nokia.com>2021-02-17 22:18:44 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-03-11 09:37:49 +0100
commitecd400ce5f97e03aed6bef9bc4efb1befdbf779b (patch)
tree70ea916e0b7926b84dc807d440dc2739b6024902
parentmtd: don't lock when recursively deleting partitions (diff)
downloadlinux-dev-ecd400ce5f97e03aed6bef9bc4efb1befdbf779b.tar.xz
linux-dev-ecd400ce5f97e03aed6bef9bc4efb1befdbf779b.zip
mtd: char: Drop mtd_mutex usage from mtdchar_open()
It looks unnecessary in the function, remove it from the function having in mind to remove it completely. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210217211845.43364-1-alexander.sverdlin@nokia.com
-rw-r--r--drivers/mtd/mtdchar.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 323035d4f2d0..f31390d186ca 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -58,13 +58,10 @@ static int mtdchar_open(struct inode *inode, struct file *file)
if ((file->f_mode & FMODE_WRITE) && (minor & 1))
return -EACCES;
- mutex_lock(&mtd_mutex);
mtd = get_mtd_device(NULL, devnum);
- if (IS_ERR(mtd)) {
- ret = PTR_ERR(mtd);
- goto out;
- }
+ if (IS_ERR(mtd))
+ return PTR_ERR(mtd);
if (mtd->type == MTD_ABSENT) {
ret = -ENODEV;
@@ -84,13 +81,10 @@ static int mtdchar_open(struct inode *inode, struct file *file)
}
mfi->mtd = mtd;
file->private_data = mfi;
- mutex_unlock(&mtd_mutex);
return 0;
out1:
put_mtd_device(mtd);
-out:
- mutex_unlock(&mtd_mutex);
return ret;
} /* mtdchar_open */