]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
of: plugin-manager: copy properties for adding/updating
authorLaxman Dewangan <ldewangan@nvidia.com>
Wed, 14 Oct 2015 08:56:18 +0000 (14:26 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 8 Dec 2015 15:44:29 +0000 (07:44 -0800)
Create copied version of properties before updating or
adding in target node as this is permanently used by
target node.

Change-Id: I1831391097baaae8b345725180b71fe238960b75
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/817450
(cherry picked from commit 756d0ccd51f1f98b45766963c87094d91cf99a45)
Reviewed-on: http://git-master/r/842357
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Shreshtha Sahu <ssahu@nvidia.com>
drivers/of/plugin-manager.c

index e31be57caecb92a8d0a7ad803552303de7be20c7..eceed067f6251b1921851de54fb9aa941eac4912 100644 (file)
@@ -66,25 +66,27 @@ static int __init update_target_node_from_overlay(
                        !strcmp(prop->name, "phandle") ||
                        !strcmp(prop->name, "linux,phandle"))
                                continue;
+
+               new_prop = __of_copy_property(prop, GFP_KERNEL);
+               if (!new_prop) {
+                       pr_err("Prop %s can not be duplicated\n",
+                               prop->name);
+                       return -EINVAL;
+               }
+
                tprop = of_find_property(target, prop->name, &lenp);
                if (!tprop) {
-                       ret = of_add_property(target, prop);
+                       ret = of_add_property(target, new_prop);
                        if (ret < 0) {
                                pr_err("Prop %s can not be added on node %s\n",
-                                       prop->name, target->full_name);
+                                       new_prop->name, target->full_name);
                                return ret;
                        }
                } else {
-                       new_prop = __of_copy_property(prop, GFP_KERNEL);
-                       if (!new_prop) {
-                               pr_err("Prop %s can not be duplicated\n",
-                                       prop->name);
-                               return -EINVAL;
-                       }
                        ret = of_update_property(target, new_prop);
                        if (ret < 0) {
                                pr_err("Prop %s can not be updated on node %s\n",
-                                       prop->name, target->full_name);
+                                       new_prop->name, target->full_name);
                                return ret;
                        }
                }