This is a note to let you know that I've just added the patch titled
mtd: Avoid probe failures when mtd->dbg.dfs_dir is invalid
to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: mtd-avoid-probe-failures-when-mtd-dbg.dfs_dir-is-invalid.patch and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
From 1530578abdac4edce9244c7a1962ded3ffdb58ce Mon Sep 17 00:00:00 2001
From: Boris Brezillon boris.brezillon@free-electrons.com Date: Sat, 11 Nov 2017 16:08:34 +0100 Subject: mtd: Avoid probe failures when mtd->dbg.dfs_dir is invalid
From: Boris Brezillon boris.brezillon@free-electrons.com
commit 1530578abdac4edce9244c7a1962ded3ffdb58ce upstream.
Commit e8e3edb95ce6 ("mtd: create per-device and module-scope debugfs entries") tried to make MTD related debugfs stuff consistent across the MTD framework by creating a root <debugfs>/mtd/ directory containing one directory per MTD device.
The problem is that, by default, the MTD layer only registers the master device if no partitions are defined for this master. This behavior breaks all drivers that expect mtd->dbg.dfs_dir to be filled correctly after calling mtd_device_register() in order to add their own debugfs entries.
The only way we can force all MTD masters to be registered no matter if they expose partitions or not is by enabling the CONFIG_MTD_PARTITIONED_MASTER option.
In such situations, there's no other solution but to accept skipping debugfs initialization when dbg.dfs_dir is invalid, and when this happens, inform the user that he should consider enabling CONFIG_MTD_PARTITIONED_MASTER.
Fixes: e8e3edb95ce6 ("mtd: create per-device and module-scope debugfs entries") Cc: Mario J. Rugiero mrugiero@gmail.com Signed-off-by: Boris Brezillon boris.brezillon@free-electrons.com Reported-by: Richard Weinberger richard@nod.at Signed-off-by: Richard Weinberger richard@nod.at Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
--- drivers/mtd/devices/docg3.c | 7 ++++++- drivers/mtd/nand/nandsim.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-)
--- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1814,8 +1814,13 @@ static void __init doc_dbg_register(stru struct dentry *root = floor->dbg.dfs_dir; struct docg3 *docg3 = floor->priv;
- if (IS_ERR_OR_NULL(root)) + if (IS_ERR_OR_NULL(root)) { + if (IS_ENABLED(CONFIG_DEBUG_FS) && + !IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) + dev_warn(floor->dev.parent, + "CONFIG_MTD_PARTITIONED_MASTER must be enabled to expose debugfs stuff\n"); return; + }
debugfs_create_file("docg3_flashcontrol", S_IRUSR, root, docg3, &flashcontrol_fops); --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -520,11 +520,16 @@ static int nandsim_debugfs_create(struct struct dentry *root = nsmtd->dbg.dfs_dir; struct dentry *dent;
- if (!IS_ENABLED(CONFIG_DEBUG_FS)) + /* + * Just skip debugfs initialization when the debugfs directory is + * missing. + */ + if (IS_ERR_OR_NULL(root)) { + if (IS_ENABLED(CONFIG_DEBUG_FS) && + !IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) + NS_WARN("CONFIG_MTD_PARTITIONED_MASTER must be enabled to expose debugfs stuff\n"); return 0; - - if (IS_ERR_OR_NULL(root)) - return -1; + }
dent = debugfs_create_file("nandsim_wear_report", S_IRUSR, root, dev, &dfs_fops);
Patches currently in stable-queue which might be from boris.brezillon@free-electrons.com are
queue-4.14/mtd-nand-fix-writing-mtdoops-to-nand-flash.patch queue-4.14/mtd-nand-export-nand_reset-symbol.patch queue-4.14/mtd-nand-mtk-fix-infinite-ecc-decode-irq-issue.patch queue-4.14/mtd-nand-atmel-actually-use-the-pm-ops.patch queue-4.14/mtd-nand-omap2-fix-subpage-write.patch queue-4.14/mtd-avoid-probe-failures-when-mtd-dbg.dfs_dir-is-invalid.patch