Commit 78ce897e5d894acf9866ca504086961d7ac604aa "yaffs linux: Rationalise and
fix compilation for Linux 3.4 and 3.5" moved some of the MTD initialisation
checks from yaffs_vfs_multi.c:yaffs_internal_read_super() to a new function
yaffs_mtdif_multi.c:yaffs_get_mtd_device(). However, this function is not
actually called, with yaffs_internal_read_super() still using get_mtd_device().
As a result, the intialisation checks are no longer active. Furthermore, the
new unused function, yaffs_get_mtd_device() calls itself recusively with no
termination condition; I suspect get_mtd_device() should be used here.
This patch updates the code to what I believe was probably originally intended
as part of the code refactoring.
Signed-off-by: Angus Clark <angus.clark@st.com>
---
yaffs_mtdif_multi.c | 7 +++++--
yaffs_vfs_multi.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/yaffs_mtdif_multi.c b/yaffs_mtdif_multi.c
index 265dd78..5ea4673 100644
--- a/yaffs_mtdif_multi.c
+++ b/yaffs_mtdif_multi.c
@@ -236,12 +236,15 @@ 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 MTD device */
+ mtd = get_mtd_device(NULL, MINOR(sdev));
+ if (!mtd)
+ return NULL;
+
/* Check it's NAND */
if (mtd->type != MTD_NANDFLASH) {
yaffs_trace(YAFFS_TRACE_ALWAYS,
diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c
index 92d2f5f..4090600 100644
--- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c
@@ -2662,7 +2662,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
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",
--
1.7.7