]> 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)
commitdb37d8a517bee1c1d8ddf2588efac9702cfcdf72
treea9678692aacf084a2b5342fe31c7f532393b1bf2
parentae620d8ff59289f88d1650bee0e2abd0e9cc78ed
mtd: fix cmdlinepart parser, early naming for auto-filled MTD

Commit 027cafc3ade9 ("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: 027cafc3ade9 ("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