Skip to contentSkip to conversation

checks: fix handling of unresolved phandles for dts plugins

PATCH In review Rob Herring 3 participants 3 messages Oct 18, 2017 – Oct 19, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checks: fix handling of unresolved phandles for dts plugins

In dts plugins, it is valid to have unresolved phandle values. The check_property_phandle_args and check_interrupts_property checks failed to account for this resulting in spurious warnings or asserts, respectively. Fix this by bailing from the checks if we're checking a dts plugin as there is no way to further validate the properties.

Fixes ee3d26f6960b ("checks: add interrupts property check")
Fixes b3bbac02d5e3 ("checks: add phandle with arg property checks")
---
 checks.c | 9 +++++++++
 1 file changed, 9 insertions(+)
checks.c +9 -0
index 08a3a29edae3..e66138449886 100644
@@ -988,6 +988,10 @@ static void check_property_phandle_args(struct check *c,
 		 * entries when each index position has a specific definition.
 		 */
 		if (phandle == 0 || phandle == -1) {
+			/* Give up if this is an overlay with external references */
+			if (dti->dtsflags & DTSF_PLUGIN)
+				break;
+
 			cellsize = 0;
 			continue;
 		}
@@ -1176,6 +1180,11 @@ static void check_interrupts_property(struct check *c,
 		prop = get_property(parent, "interrupt-parent");
 		if (prop) {
 			phandle = propval_cell(prop);
+			/* Give up if this is an overlay with external references */
+			if ((phandle == 0 || phandle == -1) &&
+			    (dti->dtsflags & DTSF_PLUGIN))
+					return;
+
 			irq_node = get_node_by_phandle(root, phandle);
 			if (!irq_node) {
 				FAIL(c, dti, "Bad interrupt-parent phandle for %s",
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): 20171018212914.13703-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw
Quoted 10 lines · Rob Herring

In dts plugins, it is valid to have unresolved phandle values. The check_property_phandle_args and check_interrupts_property checks failed to account for this resulting in spurious warnings or asserts, respectively. Fix this by bailing from the checks if we're checking a dts plugin as there is no way to further validate the properties.

Fixes ee3d26f6960b ("checks: add interrupts property check")
Fixes b3bbac02d5e3 ("checks: add phandle with arg property checks")

Applied, thanks. A testcase that prevents a regression here might be a nice follow on.

Quoted 31 lines
---
 checks.c | 9 +++++++++
 1 file changed, 9 insertions(+)
checks.c +9 -0
index 08a3a29edae3..e66138449886 100644
@@ -988,6 +988,10 @@ static void check_property_phandle_args(struct check *c,
 		 * entries when each index position has a specific definition.
 		 */
 		if (phandle == 0 || phandle == -1) {
+			/* Give up if this is an overlay with external references */
+			if (dti->dtsflags & DTSF_PLUGIN)
+				break;
+
 			cellsize = 0;
 			continue;
 		}
@@ -1176,6 +1180,11 @@ static void check_interrupts_property(struct check *c,
 		prop = get_property(parent, "interrupt-parent");
 		if (prop) {
 			phandle = propval_cell(prop);
+			/* Give up if this is an overlay with external references */
+			if ((phandle == 0 || phandle == -1) &&
+			    (dti->dtsflags & DTSF_PLUGIN))
+					return;
+
 			irq_node = get_node_by_phandle(root, phandle);
 			if (!irq_node) {
 				FAIL(c, dti, "Bad interrupt-parent phandle for %s",
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Rob Herring

In dts plugins, it is valid to have unresolved phandle values. The check_property_phandle_args and check_interrupts_property checks failed to account for this resulting in spurious warnings or asserts, respectively. Fix this by bailing from the checks if we're checking a dts plugin as there is no way to further validate the properties.

Quoted 7 lines
Fixes ee3d26f6960b ("checks: add interrupts property check")
Fixes b3bbac02d5e3 ("checks: add phandle with arg property checks")
---
 checks.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Hi Rob,

Thanks for the fix!

Alan

Quoted 31 lines
checks.c +9 -1
index 08a3a29edae3..e66138449886 100644
@@ -988,6 +988,10 @@ static void check_property_phandle_args(struct check *c,
                 * entries when each index position has a specific definition.
                 */
                if (phandle == 0 || phandle == -1) {
+                       /* Give up if this is an overlay with external references */
+                       if (dti->dtsflags & DTSF_PLUGIN)
+                               break;
+
                        cellsize = 0;
                        continue;
                }
@@ -1176,6 +1180,11 @@ static void check_interrupts_property(struct check *c,
                prop = get_property(parent, "interrupt-parent");
                if (prop) {
                        phandle = propval_cell(prop);
+                       /* Give up if this is an overlay with external references */
+                       if ((phandle == 0 || phandle == -1) &&
+                           (dti->dtsflags & DTSF_PLUGIN))
+                                       return;
+
                        irq_node = get_node_by_phandle(root, phandle);
                        if (!irq_node) {
                                FAIL(c, dti, "Bad interrupt-parent phandle for %s",
--

2.11.0