aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2019-12-03 09:38:27 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2019-12-03 09:38:27 -0500
commitd5df6b471128599b8f8a1f7c3f4001a934d27f52 (patch)
treec7e54d9539726c3b0e2a9ed5f585f42e99163277
parentc93e118aa57add3ea468c964266f989599cbf3aa (diff)
parente134f08ae95bca12eacd64834145d21faa54f097 (diff)
downloadlinux-yocto-v5.2/standard/preempt-rt/intel-x86.tar.gz
linux-yocto-v5.2/standard/preempt-rt/intel-x86.tar.bz2
linux-yocto-v5.2/standard/preempt-rt/intel-x86.zip
Merge branch 'v5.2/standard/base' into v5.2/standard/preempt-rt/intel-x86v5.2/standard/preempt-rt/intel-x86
-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;
}