Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4edaf56e0f8a6f71e3361bf74e3dc835811761e6
Commit:     4edaf56e0f8a6f71e3361bf74e3dc835811761e6
Parent:     a25b7fee537ab4dbc6eb301bd455ee8d01b707f6
Author:     Valentine Barshak <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 29 23:29:02 2007 +0300
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Tue Oct 30 08:54:39 2007 -0400

    MTD: small physmap_of partition parsing fixes
    
    Use of_get_next_child for proper ref counting as suggested by Stephen 
Rothwell
    and remove add_mtd_partitions from parse_partitions to avoid duplicate
    mtd device registration for RedBoot partitions.
    
    Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
    Acked-by: David Gibson <[EMAIL PROTECTED]>
    Heckled-for-on-IRC-by: Josh Boyer <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 drivers/mtd/maps/physmap_of.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index aeed9ea..d4bcd3f 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -94,14 +94,13 @@ static int __devinit parse_partitions(struct of_flash *info,
         * line, these take precedence over device tree information */
        nr_parts = parse_mtd_partitions(info->mtd, part_probe_types,
                                        &info->parts, 0);
-       if (nr_parts > 0) {
-               add_mtd_partitions(info->mtd, info->parts, nr_parts);
-               return 0;
-       }
+       if (nr_parts > 0)
+               return nr_parts;
 
        /* First count the subnodes */
        nr_parts = 0;
-       for (pp = dp->child; pp; pp = pp->sibling)
+       for (pp = of_get_next_child(dp, NULL); pp;
+            pp = of_get_next_child(dp, pp))
                nr_parts++;
 
        if (nr_parts == 0)
@@ -112,12 +111,14 @@ static int __devinit parse_partitions(struct of_flash 
*info,
        if (!info->parts)
                return -ENOMEM;
 
-       for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) {
+       for (pp = of_get_next_child(dp, NULL), i = 0; pp;
+            pp = of_get_next_child(dp, pp), i++) {
                const u32 *reg;
                int len;
 
                reg = of_get_property(pp, "reg", &len);
                if (!reg || (len != 2*sizeof(u32))) {
+                       of_node_put(pp);
                        dev_err(&dev->dev, "Invalid 'reg' on %s\n",
                                dp->full_name);
                        kfree(info->parts);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to