}
 
 static int mtd_add_device_partitions(struct mtd_info *mtd,
-                                    struct mtd_partition *real_parts,
+                                    const struct mtd_partition *real_parts,
                                     int nbparts)
 {
        int ret;
                              int nr_parts)
 {
        int ret;
-       struct mtd_partition *real_parts = NULL;
+       const struct mtd_partition *real_parts = NULL;
 
        ret = parse_mtd_partitions(mtd, types, &real_parts, parser_data);
        if (ret <= 0 && nr_parts && parts) {
-               real_parts = kmemdup(parts, sizeof(*parts) * nr_parts,
-                                    GFP_KERNEL);
-               if (!real_parts)
-                       ret = -ENOMEM;
-               else
-                       ret = nr_parts;
+               real_parts = parts;
+               ret = nr_parts;
        }
        /* Didn't come up with either parsed OR fallback partitions */
        if (ret < 0) {
        }
 
 out:
-       kfree(real_parts);
+       /* Cleanup any parsed partitions */
+       if (real_parts != parts)
+               kfree(real_parts);
        return ret;
 }
 EXPORT_SYMBOL_GPL(mtd_device_parse_register);
 
 int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
 int del_mtd_partitions(struct mtd_info *);
 int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
-                        struct mtd_partition **pparts,
+                        const struct mtd_partition **pparts,
                         struct mtd_part_parser_data *data);
 
 int __init init_mtdchar(void);
 
  *   point to an array containing this number of &struct mtd_info objects.
  */
 int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
-                        struct mtd_partition **pparts,
+                        const struct mtd_partition **pparts,
                         struct mtd_part_parser_data *data)
 {
        struct mtd_part_parser *parser;