of: Clean up of_update_property
authorGuenter Roeck <linux@roeck-us.net>
Tue, 15 Apr 2014 15:38:17 +0000 (08:38 -0700)
committerRob Herring <robh@kernel.org>
Tue, 15 Apr 2014 20:21:22 +0000 (15:21 -0500)
After searching for the old property, bail out with -ENODEV
if it was not found.

It is unnecessary to check if oldprop is NULL before removing
its binary file; the check was already done before.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/base.c

index f72d19b7e5d29901471784f01e6b27909c772395..6d4ee22708c93791d53860c0243d6a9258678283 100644 (file)
@@ -1828,17 +1828,13 @@ int of_update_property(struct device_node *np, struct property *newprop)
                next = &(*next)->next;
        }
        raw_spin_unlock_irqrestore(&devtree_lock, flags);
-       if (rc)
-               return rc;
+       if (!found)
+               return -ENODEV;
 
        /* Update the sysfs attribute */
-       if (oldprop)
-               sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
+       sysfs_remove_bin_file(&np->kobj, &oldprop->attr);
        __of_add_property_sysfs(np, newprop);
 
-       if (!found)
-               return -ENODEV;
-
        return 0;
 }