* [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node()
@ 2026-07-21 10:54 Xu Yang
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Xu Yang @ 2026-07-21 10:54 UTC (permalink / raw)
To: gregkh, rafael, dakr, robh, saravanak, andriy.shevchenko
Cc: bartosz.golaszewski, driver-core, linux-kernel, devicetree, imx
From: Xu Yang <xu.yang_2@nxp.com>
This patchset will fix lkp reported issue when adding test cases for
fwnode_for_each_child_node().
ERROR: modpost: "of_node_ktype"
[drivers/base/test/property-entry-test.ko] undefined!
Xu Yang (2):
of: kobj: export of_node_ktype for use by modules
device property: add test cases for fwnode_for_each_child_node()
drivers/base/test/Kconfig | 1 +
drivers/base/test/property-entry-test.c | 137 ++++++++++++++++++++++++
drivers/of/kobj.c | 2 +
3 files changed, 140 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 10:54 [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
@ 2026-07-21 10:54 ` Xu Yang
2026-07-21 11:03 ` sashiko-bot
` (2 more replies)
2026-07-21 10:54 ` [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
` (2 subsequent siblings)
3 siblings, 3 replies; 13+ messages in thread
From: Xu Yang @ 2026-07-21 10:54 UTC (permalink / raw)
To: gregkh, rafael, dakr, robh, saravanak, andriy.shevchenko
Cc: bartosz.golaszewski, driver-core, linux-kernel, devicetree, imx
From: Xu Yang <xu.yang_2@nxp.com>
of_node_init() is a static inline that references of_node_ktype when
CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
have an unresolved reference to of_node_ktype at load time, because
the symbol is defined in drivers/of/kobj.c but was never exported.
This causes a modpost build error when CONFIG_OF_KOBJ=y and
CONFIG_DRIVER_PE_KUNIT_TEST=m:
ERROR: modpost: "of_node_ktype"
[drivers/base/test/property-entry-test.ko] undefined!
Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
KUnit property-entry test can call of_node_init() without hitting this
linker error.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202607181651.RnUuV8n6-lkp@intel.com/
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
Changes in v6:
- use EXPORT_SYMBOL_IF_KUNIT as suggested by Andy Shevchenko
Changes in v5:
- new one
---
drivers/of/kobj.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index 1bb61a2c3399..081b8fa38603 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/of.h>
#include <linux/slab.h>
+#include <kunit/visibility.h>
#include "of_private.h"
@@ -27,6 +28,7 @@ static void of_node_release(struct kobject *kobj)
const struct kobj_type of_node_ktype = {
.release = of_node_release,
};
+EXPORT_SYMBOL_IF_KUNIT(of_node_ktype);
static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj,
const struct bin_attribute *bin_attr, char *buf,
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 10:54 [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
@ 2026-07-21 10:54 ` Xu Yang
2026-07-21 11:08 ` sashiko-bot
2026-07-21 11:17 ` Andy Shevchenko
2026-07-21 11:15 ` [PATCH v6 0/2] " Andy Shevchenko
2026-07-21 21:43 ` Danilo Krummrich
3 siblings, 2 replies; 13+ messages in thread
From: Xu Yang @ 2026-07-21 10:54 UTC (permalink / raw)
To: gregkh, rafael, dakr, robh, saravanak, andriy.shevchenko
Cc: bartosz.golaszewski, driver-core, linux-kernel, devicetree, imx
From: Xu Yang <xu.yang_2@nxp.com>
Add test cases for fwnode_for_each_child_node() API.
Test command:
$ ./tools/testing/kunit/kunit.py run property-entry
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
Changes in v6:
- add MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING")
- remove Andy's tag
Changes in v5:
- add patch#1 to fix "of_node_ktype undefined error"
---
drivers/base/test/Kconfig | 1 +
drivers/base/test/property-entry-test.c | 137 ++++++++++++++++++++++++
2 files changed, 138 insertions(+)
diff --git a/drivers/base/test/Kconfig b/drivers/base/test/Kconfig
index 1ecf0791241a..542ce07530a1 100644
--- a/drivers/base/test/Kconfig
+++ b/drivers/base/test/Kconfig
@@ -17,6 +17,7 @@ config DM_KUNIT_TEST
config DRIVER_PE_KUNIT_TEST
tristate "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS
depends on KUNIT
+ select OF
default KUNIT_ALL_TESTS
config DRIVER_SWNODE_KUNIT_TEST
diff --git a/drivers/base/test/property-entry-test.c b/drivers/base/test/property-entry-test.c
index a8657eb06f94..855e73b9b21f 100644
--- a/drivers/base/test/property-entry-test.c
+++ b/drivers/base/test/property-entry-test.c
@@ -4,6 +4,8 @@
// Copyright 2019 Google LLC.
#include <kunit/test.h>
+
+#include <linux/of.h>
#include <linux/property.h>
#include <linux/types.h>
@@ -489,6 +491,139 @@ static void pe_test_reference(struct kunit *test)
software_node_unregister_node_group(group);
}
+static struct fwnode_handle *create_device_node(struct kunit *test,
+ const char *name,
+ const char *full_name,
+ struct device_node *parent)
+{
+ struct device_node *node;
+
+ node = kunit_kzalloc(test, sizeof(*node), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, node);
+
+ node->name = kunit_kstrdup(test, name, GFP_KERNEL);
+ node->full_name = kunit_kstrdup(test, full_name, GFP_KERNEL);
+
+ if (parent) {
+ node->sibling = parent->child;
+ /* set the node as the first child of the parent */
+ parent->child = node;
+ node->parent = parent;
+ }
+
+ of_node_init(node);
+ return of_fwnode_handle(node);
+}
+
+/* Verifies that fwnode_for_each_child_node() can output correct children */
+static void pe_test_child_iteration(struct kunit *test)
+{
+ struct fwnode_handle *of_node, *of_node1;
+ struct fwnode_handle *sw_node, *sw_node1;
+ struct fwnode_handle *child;
+ int error, i, num;
+
+ static const struct software_node node = { .name = "sw" };
+ static const struct software_node node1 = { .name = "sw-1", .parent = &node};
+ static const struct software_node node2 = { .name = "sw-2", .parent = &node};
+ static const struct software_node node3 = { .name = "sw-3", .parent = &node};
+ static const struct software_node *group[] = { &node, &node1, &node2, &node3, NULL };
+
+ static const char * const of_child_array[] = { "of-1", "of-2", "of-3" };
+ static const char * const sw_child_array[] = { "sw-1", "sw-2", "sw-3" };
+ static const char * const of_sw_child_array[] = { "of-1", "of-2", "of-3",
+ "sw-1", "sw-2", "sw-3" };
+ static const char * const sw_of_child_array[] = { "sw-1", "sw-2", "sw-3",
+ "of-1", "of-2", "of-3" };
+
+ /* 1. Test OF node child iteration */
+
+ of_node = create_device_node(test, "of", "of", NULL);
+ create_device_node(test, "of", "of-3", to_of_node(of_node));
+ create_device_node(test, "of", "of-2", to_of_node(of_node));
+ of_node1 = create_device_node(test, "of", "of-1", to_of_node(of_node));
+
+ i = 0;
+ num = ARRAY_SIZE(of_child_array);
+ fwnode_for_each_child_node(of_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, of_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ /* 2. Test SW node child iteration */
+
+ error = software_node_register_node_group(group);
+ KUNIT_ASSERT_EQ(test, error, 0);
+
+ sw_node = software_node_fwnode(&node);
+
+ i = 0;
+ num = ARRAY_SIZE(sw_child_array);
+ fwnode_for_each_child_node(sw_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, sw_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ /* 3. Test OF (primary) + SW (secondary) node child iteration */
+
+ of_node->secondary = sw_node;
+ sw_node->secondary = ERR_PTR(-ENODEV);
+
+ i = 0;
+ num = ARRAY_SIZE(of_sw_child_array);
+ fwnode_for_each_child_node(of_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, of_sw_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ /* 4. Test SW (primary) + OF (secondary) node child iteration */
+
+ sw_node->secondary = of_node;
+ of_node->secondary = ERR_PTR(-ENODEV);
+
+ i = 0;
+ num = ARRAY_SIZE(sw_of_child_array);
+ fwnode_for_each_child_node(sw_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, sw_of_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ /* 5. Test OF (primary) + SW (secondary, but no children) node child iteration */
+
+ sw_node1 = software_node_fwnode(&node1);
+ of_node->secondary = sw_node1;
+ sw_node->secondary = ERR_PTR(-ENODEV);
+
+ i = 0;
+ num = ARRAY_SIZE(of_child_array);
+ fwnode_for_each_child_node(of_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, of_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ /* 6. Test SW (primary) + OF (secondary, but no children) node child iteration */
+
+ sw_node->secondary = of_node1;
+ of_node->secondary = ERR_PTR(-ENODEV);
+
+ i = 0;
+ num = ARRAY_SIZE(sw_child_array);
+ fwnode_for_each_child_node(sw_node, child) {
+ KUNIT_ASSERT_LT(test, i, num);
+ KUNIT_EXPECT_STREQ(test, sw_child_array[i++], fwnode_get_name(child));
+ }
+ KUNIT_EXPECT_PTR_EQ(test, child, NULL);
+
+ of_node->secondary = NULL;
+ sw_node->secondary = NULL;
+ software_node_unregister_node_group(group);
+}
+
static struct kunit_case property_entry_test_cases[] = {
KUNIT_CASE(pe_test_uints),
KUNIT_CASE(pe_test_uint_arrays),
@@ -497,6 +632,7 @@ static struct kunit_case property_entry_test_cases[] = {
KUNIT_CASE(pe_test_move_inline_u8),
KUNIT_CASE(pe_test_move_inline_str),
KUNIT_CASE(pe_test_reference),
+ KUNIT_CASE(pe_test_child_iteration),
{ }
};
@@ -509,4 +645,5 @@ kunit_test_suite(property_entry_test_suite);
MODULE_DESCRIPTION("Test module for the property entry API");
MODULE_AUTHOR("Dmitry Torokhov <dtor@chromium.org>");
+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
@ 2026-07-21 11:03 ` sashiko-bot
2026-07-21 11:16 ` Andy Shevchenko
2026-07-21 13:37 ` Rob Herring
2 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-07-21 11:03 UTC (permalink / raw)
To: Xu Yang; +Cc: imx, conor+dt, devicetree, robh, Frank.Li
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch misdiagnoses the root cause of the linkage error and introduces a new modpost namespace error, while leaving non-KUnit modules vulnerable.
--
--- Patch [1]: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules ---
commit b369d1afd3eb881423af86a559a0aec84ce01a01
Author: Xu Yang <xu.yang_2@nxp.com>
of: kobj: export of_node_ktype for use by modules
This commit attempts to fix a modpost build error where of_node_ktype is
undefined in the KUnit property-entry test by exporting the symbol via
EXPORT_SYMBOL_IF_KUNIT.
Link: https://lore.kernel.org/oe-kbuild-all/202607181651.RnUuV8n6-lkp@intel.com/
> diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
> index 1bb61a2c33994..081b8fa38603f 100644
> --- a/drivers/of/kobj.c
> +++ b/drivers/of/kobj.c
[ ... ]
> @@ -27,6 +28,7 @@ static void of_node_release(struct kobject *kobj)
> const struct kobj_type of_node_ktype = {
> .release = of_node_release,
> };
> +EXPORT_SYMBOL_IF_KUNIT(of_node_ktype);
[Severity: Medium]
Does this export actually resolve the build failure, or does it replace the
undefined symbol error with a modpost namespace error?
Since the property-entry test module likely lacks a corresponding
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"), the build might still fail
with an error indicating that the module uses a symbol from the
EXPORTED_FOR_KUNIT_TESTING namespace but does not import it.
Additionally, is the root cause actually the static inline of_node_init()
function in include/linux/of.h?
include/linux/of.h:of_node_init() {
#if defined(CONFIG_OF_KOBJ)
kobject_init(&node->kobj, &of_node_ktype);
#endif
fwnode_init(&node->fwnode, &of_fwnode_ops);
}
If non-KUnit modules include include/linux/of.h and are built with compiler
flags that emit out-of-line copies of unused static inline functions (such
as under KASAN or with keep-inline-functions), won't they still encounter
the undefined symbol error since of_node_ktype is only exported for KUnit?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260721105448.2109894-1-xu.yang_2@oss.nxp.com?part=1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 10:54 ` [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
@ 2026-07-21 11:08 ` sashiko-bot
2026-07-21 11:17 ` Andy Shevchenko
1 sibling, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-07-21 11:08 UTC (permalink / raw)
To: Xu Yang; +Cc: Frank.Li, devicetree, conor+dt, robh, imx
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
New issues:
- [High] KUnit assertions bypass manual cleanup of globally registered software nodes, creating a Use-After-Free condition.
- [Medium] The fwnode_for_each_child_node() iterator leaks its reference count on early abort.
- [Medium] Mock device_node structures are initialized without the OF_DETACHED flag, triggering kernel errors when refcounts drop to zero.
Pre-existing issues:
- [High] Test cases combining primary and secondary nodes trigger pre-existing infinite loop and double-put bugs in fwnode_get_next_child_node().
--
--- Patch [2]: [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() ---
commit 277f54edf9f4c448f3aa8bc3a07e347d304940c6
Author: Xu Yang <xu.yang_2@nxp.com>
device property: add test cases for fwnode_for_each_child_node()
This commit adds KUnit test cases for the fwnode_for_each_child_node() API.
> diff --git a/drivers/base/test/property-entry-test.c b/drivers/base/test/property-entry-test.c
> index a8657eb06f94e..855e73b9b21f2 100644
> --- a/drivers/base/test/property-entry-test.c
> +++ b/drivers/base/test/property-entry-test.c
[ ... ]
> @@ -489,6 +491,139 @@ static void pe_test_reference(struct kunit *test)
> software_node_unregister_node_group(group);
> }
>
> +static struct fwnode_handle *create_device_node(struct kunit *test,
> + const char *name,
> + const char *full_name,
> + struct device_node *parent)
> +{
> + struct device_node *node;
> +
> + node = kunit_kzalloc(test, sizeof(*node), GFP_KERNEL);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, node);
> +
> + node->name = kunit_kstrdup(test, name, GFP_KERNEL);
> + node->full_name = kunit_kstrdup(test, full_name, GFP_KERNEL);
> +
> + if (parent) {
> + node->sibling = parent->child;
> + /* set the node as the first child of the parent */
> + parent->child = node;
> + node->parent = parent;
> + }
> +
> + of_node_init(node);
> + return of_fwnode_handle(node);
> +}
[Severity: Medium]
Will this mock node initialization trigger kernel errors when the node's
refcount reaches zero?
Because the OF_DETACHED flag is not set on the device_node, of_node_release()
will assume the node was improperly detached and will emit a pr_err() and a
stack dump when releasing the structure.
Should we set the OF_DETACHED flag before initializing the node here?
> +
> +/* Verifies that fwnode_for_each_child_node() can output correct children */
> +static void pe_test_child_iteration(struct kunit *test)
> +{
[ ... ]
> + /* 3. Test OF (primary) + SW (secondary) node child iteration */
> +
> + of_node->secondary = sw_node;
> + sw_node->secondary = ERR_PTR(-ENODEV);
> +
> + i = 0;
> + num = ARRAY_SIZE(of_sw_child_array);
> + fwnode_for_each_child_node(of_node, child) {
[Severity: High]
This is a pre-existing issue, but will this test case trigger an infinite
loop and double-put bug in the core framework?
When the primary OF iterator finishes and drops its last child reference,
fwnode_get_next_child_node() in drivers/base/property.c passes that
already-put child to the secondary software node iterator, causing a
double-put of the kobject reference.
Then, when the SW iterator returns its first child, the next iteration passes
it back to the primary OF iterator. Since the OF iterator does not recognize
SW nodes, it treats the child as NULL and restarts from the first OF child,
causing an infinite loop.
This test case currently fails at the KUNIT_ASSERT_LT below due to the
infinite loop, which aborts the run.
> + KUNIT_ASSERT_LT(test, i, num);
[Severity: Medium]
Does this assertion leak the child fwnode reference count if it fails?
The fwnode_for_each_child_node() iterator holds a reference count on the
active child node. If KUNIT_ASSERT_LT() fails and forces an early return,
the reference count isn't released via fwnode_handle_put().
> + KUNIT_EXPECT_STREQ(test, of_sw_child_array[i++], fwnode_get_name(child));
> + }
> + KUNIT_EXPECT_PTR_EQ(test, child, NULL);
> +
[ ... ]
> + of_node->secondary = NULL;
> + sw_node->secondary = NULL;
> + software_node_unregister_node_group(group);
> +}
[Severity: High]
If any KUNIT_ASSERT_* fails earlier in this function, doesn't it bypass
this manual cleanup?
A forced early return bypasses software_node_unregister_node_group(),
leaving the software nodes permanently registered in the global sysfs kset.
Since KUnit automatically frees the mock of_node instances allocated with
kunit_kzalloc() upon test exit, wouldn't the globally persisted software
nodes be left with dangling .secondary pointers referencing freed memory,
creating a use-after-free condition?
Could we use kunit_add_action() when registering the group to ensure the
software nodes are unregistered even if an assertion fails?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260721105448.2109894-1-xu.yang_2@oss.nxp.com?part=2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 10:54 [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
2026-07-21 10:54 ` [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
@ 2026-07-21 11:15 ` Andy Shevchenko
2026-07-21 14:28 ` Xu Yang
2026-07-21 21:43 ` Danilo Krummrich
3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-21 11:15 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 06:54:46PM +0800, Xu Yang wrote:
> This patchset will fix lkp reported issue when adding test cases for
> fwnode_for_each_child_node().
>
> ERROR: modpost: "of_node_ktype"
> [drivers/base/test/property-entry-test.ko] undefined!
Why v6? Where is changelog?
No need to resend this time, reply with missing information added.
> Xu Yang (2):
> of: kobj: export of_node_ktype for use by modules
> device property: add test cases for fwnode_for_each_child_node()
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
2026-07-21 11:03 ` sashiko-bot
@ 2026-07-21 11:16 ` Andy Shevchenko
2026-07-21 11:18 ` Andy Shevchenko
2026-07-21 14:29 ` Xu Yang
2026-07-21 13:37 ` Rob Herring
2 siblings, 2 replies; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-21 11:16 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 06:54:47PM +0800, Xu Yang wrote:
> of_node_init() is a static inline that references of_node_ktype when
> CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
> have an unresolved reference to of_node_ktype at load time, because
> the symbol is defined in drivers/of/kobj.c but was never exported.
>
> This causes a modpost build error when CONFIG_OF_KOBJ=y and
> CONFIG_DRIVER_PE_KUNIT_TEST=m:
>
> ERROR: modpost: "of_node_ktype"
> [drivers/base/test/property-entry-test.ko] undefined!
>
> Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
> KUnit property-entry test can call of_node_init() without hitting this
> linker error.
...
> #include <linux/of.h>
> #include <linux/slab.h>
+ blank line.
> +#include <kunit/visibility.h>
>
> #include "of_private.h"
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 10:54 ` [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
2026-07-21 11:08 ` sashiko-bot
@ 2026-07-21 11:17 ` Andy Shevchenko
1 sibling, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-21 11:17 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 06:54:48PM +0800, Xu Yang wrote:
> Add test cases for fwnode_for_each_child_node() API.
>
> Test command:
> $ ./tools/testing/kunit/kunit.py run property-entry
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 11:16 ` Andy Shevchenko
@ 2026-07-21 11:18 ` Andy Shevchenko
2026-07-21 14:29 ` Xu Yang
1 sibling, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-21 11:18 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 02:16:24PM +0300, Andy Shevchenko wrote:
> On Tue, Jul 21, 2026 at 06:54:47PM +0800, Xu Yang wrote:
>
> > of_node_init() is a static inline that references of_node_ktype when
> > CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
> > have an unresolved reference to of_node_ktype at load time, because
> > the symbol is defined in drivers/of/kobj.c but was never exported.
> >
> > This causes a modpost build error when CONFIG_OF_KOBJ=y and
> > CONFIG_DRIVER_PE_KUNIT_TEST=m:
> >
> > ERROR: modpost: "of_node_ktype"
> > [drivers/base/test/property-entry-test.ko] undefined!
> >
> > Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
> > KUnit property-entry test can call of_node_init() without hitting this
> > linker error.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
...
> > #include <linux/of.h>
> > #include <linux/slab.h>
>
> + blank line.
>
> > +#include <kunit/visibility.h>
> >
> > #include "of_private.h"
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
2026-07-21 11:03 ` sashiko-bot
2026-07-21 11:16 ` Andy Shevchenko
@ 2026-07-21 13:37 ` Rob Herring
2 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2026-07-21 13:37 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, saravanak, andriy.shevchenko,
bartosz.golaszewski, driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 5:51 AM Xu Yang <xu.yang_2@oss.nxp.com> wrote:
>
> From: Xu Yang <xu.yang_2@nxp.com>
>
> of_node_init() is a static inline that references of_node_ktype when
> CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
> have an unresolved reference to of_node_ktype at load time, because
> the symbol is defined in drivers/of/kobj.c but was never exported.
>
> This causes a modpost build error when CONFIG_OF_KOBJ=y and
> CONFIG_DRIVER_PE_KUNIT_TEST=m:
>
> ERROR: modpost: "of_node_ktype"
> [drivers/base/test/property-entry-test.ko] undefined!
>
> Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
> KUnit property-entry test can call of_node_init() without hitting this
> linker error.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607181651.RnUuV8n6-lkp@intel.com/
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 11:15 ` [PATCH v6 0/2] " Andy Shevchenko
@ 2026-07-21 14:28 ` Xu Yang
0 siblings, 0 replies; 13+ messages in thread
From: Xu Yang @ 2026-07-21 14:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
Hi Andy,
On Tue, Jul 21, 2026 at 02:15:22PM +0300, Andy Shevchenko wrote:
> On Tue, Jul 21, 2026 at 06:54:46PM +0800, Xu Yang wrote:
>
> > This patchset will fix lkp reported issue when adding test cases for
> > fwnode_for_each_child_node().
> >
> > ERROR: modpost: "of_node_ktype"
> > [drivers/base/test/property-entry-test.ko] undefined!
>
> Why v6? Where is changelog?
> No need to resend this time, reply with missing information added.
The previous patchset was v5, which I created by continuing from the
v4 patchset you had pushed.
So I continue v6 here.
Changes in v6:
- Use EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) for kuint test
Changes in v5:
- add EXPORT_SYMBOL_GPL(of_node_ktype) to fix the issue
- Link: https://lore.kernel.org/driver-core/20260720104730.1285552-1-xu.yang_2@oss.nxp.com/
Thanks,
Xu Yang
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules
2026-07-21 11:16 ` Andy Shevchenko
2026-07-21 11:18 ` Andy Shevchenko
@ 2026-07-21 14:29 ` Xu Yang
1 sibling, 0 replies; 13+ messages in thread
From: Xu Yang @ 2026-07-21 14:29 UTC (permalink / raw)
To: Andy Shevchenko
Cc: gregkh, rafael, dakr, robh, saravanak, bartosz.golaszewski,
driver-core, linux-kernel, devicetree, imx
On Tue, Jul 21, 2026 at 02:16:19PM +0300, Andy Shevchenko wrote:
> On Tue, Jul 21, 2026 at 06:54:47PM +0800, Xu Yang wrote:
>
> > of_node_init() is a static inline that references of_node_ktype when
> > CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
> > have an unresolved reference to of_node_ktype at load time, because
> > the symbol is defined in drivers/of/kobj.c but was never exported.
> >
> > This causes a modpost build error when CONFIG_OF_KOBJ=y and
> > CONFIG_DRIVER_PE_KUNIT_TEST=m:
> >
> > ERROR: modpost: "of_node_ktype"
> > [drivers/base/test/property-entry-test.ko] undefined!
> >
> > Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
> > KUnit property-entry test can call of_node_init() without hitting this
> > linker error.
>
> ...
>
> > #include <linux/of.h>
> > #include <linux/slab.h>
>
> + blank line.
OK.
Thanks,
Xu Yang
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node()
2026-07-21 10:54 [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
` (2 preceding siblings ...)
2026-07-21 11:15 ` [PATCH v6 0/2] " Andy Shevchenko
@ 2026-07-21 21:43 ` Danilo Krummrich
3 siblings, 0 replies; 13+ messages in thread
From: Danilo Krummrich @ 2026-07-21 21:43 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, rafael, dakr, robh, saravanak, andriy.shevchenko,
bartosz.golaszewski, driver-core, linux-kernel, devicetree, imx
On Tue, 21 Jul 2026 18:54:46 +0800, Xu Yang wrote:
> [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node()
Applied, thanks!
Branch: driver-core-testing
Tree: git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
[1/2] of: kobj: export of_node_ktype for use by modules
commit: 08bc14983723
[ Add empty line before the kunit include. - Danilo ]
[2/2] device property: add test cases for fwnode_for_each_child_node()
commit: 0e6f8ccd4618
The patches will appear in the next linux-next integration (typically within 24
hours on weekdays).
The patches are in the driver-core-testing branch and will be promoted to
driver-core-next after validation.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-07-21 21:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 10:54 [PATCH v6 0/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
2026-07-21 10:54 ` [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules Xu Yang
2026-07-21 11:03 ` sashiko-bot
2026-07-21 11:16 ` Andy Shevchenko
2026-07-21 11:18 ` Andy Shevchenko
2026-07-21 14:29 ` Xu Yang
2026-07-21 13:37 ` Rob Herring
2026-07-21 10:54 ` [PATCH v6 2/2] device property: add test cases for fwnode_for_each_child_node() Xu Yang
2026-07-21 11:08 ` sashiko-bot
2026-07-21 11:17 ` Andy Shevchenko
2026-07-21 11:15 ` [PATCH v6 0/2] " Andy Shevchenko
2026-07-21 14:28 ` Xu Yang
2026-07-21 21:43 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox