[linux-yocto] [PATCH] of: Fix of_populate_phandle_cache compilation error

He Zhe zhe.he at windriver.com
Fri Nov 2 01:42:33 PDT 2018


When merging tag 'v4.18.10' into v4.18/standard/base, 05a9931 "of: fix phandle
cache creation for DTs with no phandles" from v4.18.10 introduces an undefined
label "out" and causes the follow compilation error.

drivers/of/base.c: In function 'of_populate_phandle_cache':
drivers/of/base.c:124:3: error: label 'out' used but not defined
   goto out;
   ^~~~

This is because the base of 05a9931 has been modified by b75caf0 "of: allocate /
free phandle cache outside of the devtree_lock".

This patch picks a part of
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?h=
linux-4.18.y-rt&id=9866102318991051e5e99085d3c88d6483ee70d4
to fix this error, and can be dropped when rebasing above 9866102.

Signed-off-by: He Zhe <zhe.he at windriver.com>
---
This error affects all arches building preempt-rt kernel with "of" by default.

 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ecb495df4aad..49da3726cda5 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -119,14 +119,14 @@ void of_populate_phandle_cache(void)
 			phandles++;
 
 	raw_spin_unlock_irqrestore(&devtree_lock, flags);
+	kfree(shadow);
 
 	if (!phandles)
-		goto out;
+		return;
 
 	cache_entries = roundup_pow_of_two(phandles);
 	phandle_cache_mask = cache_entries - 1;
 
-	kfree(shadow);
 	shadow = kcalloc(cache_entries, sizeof(*phandle_cache), GFP_KERNEL);
 
 	if (!shadow)
-- 
2.11.0



More information about the linux-yocto mailing list