]> git.kernelconcepts.de Git - karo-tx-linux.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)
commit472b444eef934eb7e90334efdd7fc7954cfe5132
treea9678692aacf084a2b5342fe31c7f532393b1bf2
parente488ca9f8d4f62c2dc36bfa5c32f68e7f05ab381
mtd: fix cmdlinepart parser, early naming for auto-filled MTD

Commit 807f16d4db95 ("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: 807f16d4db95 ("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