[PATCH 1/3] of: change superfluous of_fix_tree int return type to void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux