[PATCH v2 2/6] treewide: drop null pointer checks around of_delete_node
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri May 19 03:01:16 PDT 2023
of_delete_node is a no-op when called on a null pointer, so remove the
useless null checks around it.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
- new patch
---
commands/of_dump.c | 3 +--
commands/of_property.c | 3 +--
common/blspec.c | 3 +--
common/state/state.c | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/commands/of_dump.c b/commands/of_dump.c
index 86755ff1e445..87a0b1ba535c 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -120,8 +120,7 @@ static int do_of_dump(int argc, char *argv[])
of_print_nodes(node, 0, maxpropsize);
out:
- if (of_free)
- of_delete_node(of_free);
+ of_delete_node(of_free);
return ret;
}
diff --git a/commands/of_property.c b/commands/of_property.c
index 063e97775c59..b507a3541e0a 100644
--- a/commands/of_property.c
+++ b/commands/of_property.c
@@ -401,8 +401,7 @@ static int do_of_property(int argc, char *argv[])
out:
- if (root)
- of_delete_node(root);
+ of_delete_node(root);
return ret;
}
diff --git a/common/blspec.c b/common/blspec.c
index 4b4e04b03997..e95a8dba8d76 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -473,8 +473,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
ret = false;
out:
- if (root)
- of_delete_node(root);
+ of_delete_node(root);
free(filename);
return ret;
diff --git a/common/state/state.c b/common/state/state.c
index 040835702b66..6b4acbb32bcc 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -559,8 +559,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
goto out;
/* delete existing node */
- if (node)
- of_delete_node(node);
+ of_delete_node(node);
return 0;
--
2.39.2
More information about the barebox
mailing list