• Brian Norris's avatar
    mtd: fix cmdlinepart parser, early naming for auto-filled MTD · 472b444e
    Brian Norris authored
    Commit 807f16d4 ("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: 807f16d4 ("mtd: core: set some defaults when dev.parent is set")
    Reported-by: default avatarHeiko Schocher <hs@denx.de>
    Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
    Cc: Heiko Schocher <hs@denx.de>
    Cc: Frans Klaver <fransklaver@gmail.com>
    472b444e
mtdcore.c 34.7 KB