From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/3] of: change superfluous of_fix_tree int return type to void
Date: Thu, 8 Jun 2023 15:40:40 +0200 [thread overview]
Message-ID: <20230608134040.2123869-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230608134040.2123869-1-a.fatoum@pengutronix.de>
of_fix_tree always returns 0, so propagating its return code and
checking it serves no purpose. Let's just change it to void *.
I considered having it return the first argument, but that could mislead
users to think that the argument is not modified.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
commands/of_compatible.c | 7 ++-----
commands/of_dump.c | 7 ++-----
common/oftree.c | 10 ++--------
include/of.h | 2 +-
4 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/commands/of_compatible.c b/commands/of_compatible.c
index b460fecd3a86..d8704d50bb72 100644
--- a/commands/of_compatible.c
+++ b/commands/of_compatible.c
@@ -57,11 +57,8 @@ static int do_of_compatible(int argc, char *argv[])
root = of_free = of_dup(root);
}
- if (fix) {
- ret = of_fix_tree(root);
- if (ret)
- goto out;
- }
+ if (fix)
+ of_fix_tree(root);
node = of_find_node_by_path_or_alias(root, nodename);
if (!node) {
diff --git a/commands/of_dump.c b/commands/of_dump.c
index 1d6c019bf08c..c77dc27c99b9 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -84,11 +84,8 @@ static int do_of_dump(int argc, char *argv[])
root = of_free = of_dup(root);
}
- if (fix) {
- ret = of_fix_tree(root);
- if (ret)
- goto out;
- }
+ if (fix)
+ of_fix_tree(root);
node = of_find_node_by_path_or_alias(root, nodename);
if (!node) {
diff --git a/common/oftree.c b/common/oftree.c
index 1f751cc0ac89..620de6ed5649 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -392,7 +392,7 @@ int of_unregister_fixup(int (*fixup)(struct device_node *, void *),
* Apply registered fixups for the given fdt. The fdt must have
* enough free space to apply the fixups.
*/
-int of_fix_tree(struct device_node *node)
+void of_fix_tree(struct device_node *node)
{
struct of_fixup *of_fixup;
int ret;
@@ -408,8 +408,6 @@ int of_fix_tree(struct device_node *node)
pr_warn("Failed to fixup node in %pS: %s\n",
of_fixup->fixup, strerror(-ret));
}
-
- return 0;
}
/*
@@ -420,7 +418,6 @@ int of_fix_tree(struct device_node *node)
*/
struct fdt_header *of_get_fixed_tree(struct device_node *node)
{
- int ret;
struct fdt_header *fdt = NULL;
struct device_node *freenp = NULL;
@@ -434,13 +431,10 @@ struct fdt_header *of_get_fixed_tree(struct device_node *node)
return NULL;
}
- ret = of_fix_tree(node);
- if (ret)
- goto out;
+ of_fix_tree(node);
fdt = of_flatten_dtb(node);
-out:
of_delete_node(freenp);
return fdt;
diff --git a/include/of.h b/include/of.h
index 2b75ce63e185..0037bad6c4d7 100644
--- a/include/of.h
+++ b/include/of.h
@@ -65,7 +65,7 @@ struct device;
struct driver;
struct resource;
-int of_fix_tree(struct device_node *);
+void of_fix_tree(struct device_node *);
int of_match(struct device *dev, struct driver *drv);
--
2.39.2
next prev parent reply other threads:[~2023-06-08 13:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 13:40 [PATCH 0/3] commands: of_diff: support applying fixups on arbitrary device trees Ahmad Fatoum
2023-06-08 13:40 ` Ahmad Fatoum [this message]
2023-06-08 13:40 ` [PATCH 2/3] commands: of_diff: simplify error handling Ahmad Fatoum
2023-06-13 11:48 ` Johannes Zink
2023-06-08 13:40 ` [PATCH 3/3] commands: of_diff: support applying fixups on arbitrary device trees Ahmad Fatoum
2023-06-09 6:41 ` [PATCH 0/3] " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230608134040.2123869-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox