[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250224-of_bugfix-v1-4-03640ae8c3a6@quicinc.com>
Date: Mon, 24 Feb 2025 22:28:00 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH 4/5] of: Do not change property state under
__of_add_property() failure
From: Zijun Hu <quic_zijuhu@...cinc.com>
Do not remove the property from list @np->deadprops if
__of_add_property() encounters -EEXIST failure.
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/of/base.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index c810014957e81171675b63f25eaabe391cc903e4..47cae6e48a48a7e1312c25fc5267bcf39102bbe9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1646,9 +1646,6 @@ int __of_add_property(struct device_node *np, struct property *prop)
raw_spin_lock_irqsave(&devtree_lock, flags);
- __of_remove_property_from_list(&np->deadprops, prop);
-
- prop->next = NULL;
next = &np->properties;
while (*next) {
if (of_prop_cmp(prop->name, (*next)->name) == 0) {
@@ -1660,6 +1657,9 @@ int __of_add_property(struct device_node *np, struct property *prop)
}
*next = prop;
+ __of_remove_property_from_list(&np->deadprops, prop);
+ prop->next = NULL;
+
out_unlock:
raw_spin_unlock_irqrestore(&devtree_lock, flags);
if (rc)
--
2.34.1
Powered by blists - more mailing lists