diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2018-10-19 09:49:08 +0200 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-11-06 23:33:06 +0100 |
commit | 99f732b3a8656b148b3725192c8eac6982c6c80d (patch) | |
tree | ec33bf812d7f1b6b2689b5b6fcc839eb7c1d7050 /drivers/mtd/maps | |
parent | ba32ce95cbd9876eb7f5ec39af87829c8f13a337 (diff) | |
download | linux-rt-99f732b3a8656b148b3725192c8eac6982c6c80d.tar.gz |
mtd: maps: physmap: Invert logic on if/else branch
It is preferred to have the positive statement on an if/else. While we
are at it we replace the way we access rom_probe_types.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/physmap-core.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index 11e6239aadc7..e8c3b250d842 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -396,7 +396,7 @@ static int physmap_flash_of_init(struct platform_device *dev) #endif /* IS_ENABLED(CONFIG_MTD_PHYSMAP_OF) */ static const char * const rom_probe_types[] = { - "cfi_probe", "jedec_probe", "qinfo_probe", "map_rom", NULL + "cfi_probe", "jedec_probe", "qinfo_probe", "map_rom", }; static const char * const part_probe_types[] = { @@ -437,7 +437,6 @@ static int physmap_flash_pdata_init(struct platform_device *dev) static int physmap_flash_probe(struct platform_device *dev) { struct physmap_flash_info *info; - const char * const *probe_type; int err = 0; int i; @@ -519,14 +518,18 @@ static int physmap_flash_probe(struct platform_device *dev) simple_map_init(&info->maps[i]); } - probe_type = rom_probe_types; - if (!info->probe_type) { - for (; !info->mtds[i] && *probe_type; probe_type++) - info->mtds[i] = do_map_probe(*probe_type, - &info->maps[i]); - } else { + if (info->probe_type) { info->mtds[i] = do_map_probe(info->probe_type, &info->maps[i]); + } else { + int j; + + for (j = 0; j < ARRAY_SIZE(rom_probe_types); j++) { + info->mtds[i] = do_map_probe(rom_probe_types[j], + &info->maps[i]); + if (info->mtds[i]) + break; + } } if (!info->mtds[i]) { |