mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl
[pandora-kernel.git] / drivers / mtd / mtdcore.c
index f9cc2d2..b01993e 100644 (file)
@@ -362,7 +362,7 @@ int add_mtd_device(struct mtd_info *mtd)
                              MTD_DEVT(i) + 1,
                              NULL, "mtd%dro", i);
 
-       DEBUG(0, "mtd: Giving out device %d to %s\n", i, mtd->name);
+       pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name);
        /* No need to get a refcount on the module containing
           the notifier, since we hold the mtd_table_mutex */
        list_for_each_entry(not, &mtd_notifiers, list)
@@ -449,7 +449,7 @@ out_error:
  *   is used, see 'parse_mtd_partitions()' for more information). If none are
  *   found this functions tries to fallback to information specified in
  *   @parts/@nr_parts.
- * * If any parititioning info was found, this function registers the found
+ * * If any partitioning info was found, this function registers the found
  *   partitions.
  * * If no partitions were found this function just registers the MTD device
  *   @mtd and exits.
@@ -465,12 +465,13 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char **types,
        struct mtd_partition *real_parts;
 
        err = parse_mtd_partitions(mtd, types, &real_parts, parser_data);
-       if (err <= 0 && nr_parts) {
+       if (err <= 0 && nr_parts && parts) {
                real_parts = kmemdup(parts, sizeof(*parts) * nr_parts,
                                     GFP_KERNEL);
-               err = nr_parts;
-               if (!parts)
+               if (!real_parts)
                        err = -ENOMEM;
+               else
+                       err = nr_parts;
        }
 
        if (err > 0) {