mtd: mtdpart: break it as soon as we parse out the partitions
[pandora-kernel.git] / drivers / mtd / mtdpart.c
index a0bd2de..198da0a 100644 (file)
@@ -748,6 +748,8 @@ static const char *default_mtd_part_types[] = {
  * partition parsers, specified in @types. However, if @types is %NULL, then
  * the default list of parsers is used. The default list contains only the
  * "cmdlinepart" and "ofpart" parsers ATM.
+ * Note: If there are more then one parser in @types, the kernel only takes the
+ * partitions parsed out by the first parser.
  *
  * This function may return:
  * o a negative error code in case of failure
@@ -772,11 +774,12 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
                if (!parser)
                        continue;
                ret = (*parser->parse_fn)(master, pparts, data);
+               put_partition_parser(parser);
                if (ret > 0) {
                        printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n",
                               ret, parser->name, master->name);
+                       break;
                }
-               put_partition_parser(parser);
        }
        return ret;
 }