[U-Boot] [PATCH 08/10] dm: core: Supress dead-code warning in __of_get_next_child()

Simon Glass sjg at chromium.org
Wed Jun 7 16:28:45 UTC 2017


Suppress a warning on next = next->sibling.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reported-by: Coverity (CID: 163245)
Fixes 644ec0a (dm: core: Add livetree access functions)
---

 drivers/core/of_access.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 94ef3cc251..93a6560496 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -244,6 +244,12 @@ static struct device_node *__of_get_next_child(const struct device_node *node,
 		return NULL;
 
 	next = prev ? prev->sibling : node->child;
+	/*
+	 * coverity[dead_error_line : FALSE]
+	 * Dead code here since our current implementation of of_node_get()
+	 * always returns NULL (Coverity CID 163245). But we leave it as is
+	 * since we may want to implement get/put later.
+	 */
 	for (; next; next = next->sibling)
 		if (of_node_get(next))
 			break;
-- 
2.13.0.506.g27d5fe0cd-goog



More information about the U-Boot mailing list