aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2019-12-03 09:37:52 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2019-12-03 09:37:52 -0500
commitd2527321ba915e9e6ef92b2c85f6a3e04588df94 (patch)
treeb6c3eb3d6c220d0dcd9ea48e4b2d1bab88ebeb33
parent5562f2177da79150d54b16a2554652a877783db6 (diff)
parente134f08ae95bca12eacd64834145d21faa54f097 (diff)
downloadlinux-yocto-d2527321ba915e9e6ef92b2c85f6a3e04588df94.tar.gz
linux-yocto-d2527321ba915e9e6ef92b2c85f6a3e04588df94.tar.bz2
linux-yocto-d2527321ba915e9e6ef92b2c85f6a3e04588df94.zip
Merge branch 'v5.2/standard/base' into v5.2/standard/fsl-mpc8315e-rdb
-rw-r--r--fs/yaffs2/yaffs_mtdif.c12
-rw-r--r--fs/yaffs2/yaffs_vfs.c7
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/yaffs2/yaffs_mtdif.c b/fs/yaffs2/yaffs_mtdif.c
index 4ff5741f3983..054e251a2c18 100644
--- a/fs/yaffs2/yaffs_mtdif.c
+++ b/fs/yaffs2/yaffs_mtdif.c
@@ -242,17 +242,25 @@ struct mtd_info * yaffs_get_mtd_device(dev_t sdev)
{
struct mtd_info *mtd;
- mtd = yaffs_get_mtd_device(sdev);
-
/* Check it's an mtd device..... */
if (MAJOR(sdev) != MTD_BLOCK_MAJOR)
return NULL; /* This isn't an mtd device */
+ /* Get the device */
+ mtd = get_mtd_device(NULL, MINOR(sdev));
+ if (IS_ERR_OR_NULL(mtd)) {
+ yaffs_trace(YAFFS_TRACE_ALWAYS,
+ "yaffs: MTD device %u either not valid or unavailable",
+ MINOR(sdev));
+ return NULL;
+ }
+
/* Check it's NAND */
if (mtd->type != MTD_NANDFLASH) {
yaffs_trace(YAFFS_TRACE_ALWAYS,
"yaffs: MTD device is not NAND it's type %d",
mtd->type);
+ put_mtd_device(mtd);
return NULL;
}
diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index 61ac4e4c45d1..db77316a0f95 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -2881,12 +2881,9 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
MAJOR(sb->s_dev), MINOR(sb->s_dev),
yaffs_devname(sb, devname_buf));
- /* Get the device */
- mtd = get_mtd_device(NULL, MINOR(sb->s_dev));
+
+ mtd = yaffs_get_mtd_device(sb->s_dev);
if (!mtd) {
- yaffs_trace(YAFFS_TRACE_ALWAYS,
- "yaffs: MTD device %u either not valid or unavailable",
- MINOR(sb->s_dev));
return NULL;
}