]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: fix cmdlinepart parser, early naming for auto-filled MTD
authorBrian Norris <computersforpeace@gmail.com>
Fri, 11 Dec 2015 23:58:01 +0000 (15:58 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 4 Jan 2016 18:54:18 +0000 (10:54 -0800)
commit4bd0684428b2663aaf11f169ece786f400951077
treea9678692aacf084a2b5342fe31c7f532393b1bf2
parentbeab9a80892f34d5a44059b2d29593769c5b3bdf
mtd: fix cmdlinepart parser, early naming for auto-filled MTD

Commit 63cd5883e652 ("mtd: core: set some defaults when dev.parent is
set") attempted to provide some default settings for MTDs that
 (a) assign the parent device and
 (b) don't provide their own name or owner

However, this isn't a perfect drop-in replacement for the boilerplate
found in some drivers, because the MTD name is used by partition
parsers like cmdlinepart, but the name isn't set until add_mtd_device(),
after the parsing is completed. This means cmdlinepart sees a NULL name
and therefore will not work properly.

Fix this by moving the default name and owner assignment to be first in
the MTD registration process.

[Note: this does not fix all reported issues, particularly with NAND
drivers. Will require an additional fix for drivers/mtd/nand/]

Fixes: 63cd5883e652 ("mtd: core: set some defaults when dev.parent is set")
Reported-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Frans Klaver <fransklaver@gmail.com>
drivers/mtd/mtdcore.c