OSDN Git Service

mtd: Avoid probe failures when mtd->dbg.dfs_dir is invalid
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Sat, 11 Nov 2017 15:08:34 +0000 (16:08 +0100)
committerRichard Weinberger <richard@nod.at>
Mon, 13 Nov 2017 21:07:31 +0000 (22:07 +0100)
commit1530578abdac4edce9244c7a1962ded3ffdb58ce
tree14b4db16ec7239c8b717b775d073a41cf095edc8
parent8a4580e4d298796ffe5bcc5b0c39906c83a40499
mtd: Avoid probe failures when mtd->dbg.dfs_dir is invalid

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: <stable@vger.kernel.org>
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>
drivers/mtd/devices/docg3.c
drivers/mtd/nand/nandsim.c