From: "Danilo Krummrich" <dakr@kernel.org>
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <david@davidgow.net>,
"Rae Moar" <raemoar63@gmail.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Daniel Scally" <djrscally@gmail.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Bartosz Golaszewski" <brgl@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Linus Walleij" <linusw@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
<kunit-dev@googlegroups.com>, <linux-acpi@vger.kernel.org>,
<driver-core@lists.linux.dev>, <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v3 0/5] software node: provide support for fw_devlink
Date: Sun, 12 Jul 2026 18:59:04 +0200 [thread overview]
Message-ID: <DJWR3RYAWYAI.LQC41HSN2I94@kernel.org> (raw)
In-Reply-To: <20260710-swnode-fw-devlink-v3-0-993f31874e40@oss.qualcomm.com>
On Fri Jul 10, 2026 at 3:51 PM CEST, Bartosz Golaszewski wrote:
> Bartosz Golaszewski (5):
> kunit: provide a set of fwnode-oriented helpers
> software node: add fw_devlink support
> software node: add kunit tests for fw_devlink support
> MAINTAINERS: add myself as reviewer of software node support
> gpio: kunit: add test cases verifying swnode devlink support
Overall looks good, but I think the two issues pointed out by Sashiko are valid.
In addition, I also found a memory leak in the gpiolib kunit test:
unreferenced object 0xffff88810296b2c0 (size 32):
comm "kunit_try_catch", pid 1096, jiffies 4294694235
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
66 6f 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 foo.............
backtrace (crc a62f59c2):
__kmalloc_noprof+0x216/0x510
desc_set_label+0x46/0xc0
gpiod_request_commit+0xd5/0x140
gpiod_request+0x49/0x170
gpiod_find_and_request+0x2be/0x520
gpiod_get_index+0x56/0x70
devm_gpiod_get+0x1b/0x90
0xffffffffc0401ff8
platform_probe+0x58/0x90
really_probe+0x1bc/0x490
__driver_probe_device+0xa2/0x140
driver_probe_device+0x1e/0x110
__device_attach_driver+0xc2/0x140
bus_for_each_drv+0x117/0x170
__device_attach+0xd5/0x1c0
device_initial_probe+0x34/0x50
I came up with the following diff to resolve those issues.
diff --git a/drivers/base/test/swnode-devlink-test.c b/drivers/base/test/swnode-devlink-test.c
index 6f59f13214fc..143b9c4047a0 100644
--- a/drivers/base/test/swnode-devlink-test.c
+++ b/drivers/base/test/swnode-devlink-test.c
@@ -17,6 +17,10 @@
#include <kunit/platform_device.h>
#include <kunit/test.h>
+KUNIT_DEFINE_ACTION_WRAPPER(device_remove_software_node_wrapper,
+ device_remove_software_node,
+ struct device *);
+
static int swnode_count_suppliers(struct fwnode_handle *fwnode)
{
struct fwnode_link *link;
@@ -294,6 +298,9 @@ static void swnode_devlink_test_probe_order(struct kunit *test)
ret = device_add_software_node(&supplier->dev, &supplier_swnode);
KUNIT_ASSERT_EQ(test, ret, 0);
+ ret = kunit_add_action_or_reset(test, device_remove_software_node_wrapper,
+ &supplier->dev);
+ KUNIT_ASSERT_EQ(test, ret, 0);
ret = device_create_managed_software_node(&consumer->dev,
consumer_props, NULL);
KUNIT_ASSERT_EQ(test, ret, 0);
@@ -313,8 +320,6 @@ static void swnode_devlink_test_probe_order(struct kunit *test)
/* Tear down the consumer (and its device link) before the supplier. */
kunit_platform_device_unregister(test, consumer);
-
- device_remove_software_node(&supplier->dev);
}
static struct kunit_case swnode_test_cases[] = {
diff --git a/drivers/gpio/gpiolib-kunit.c b/drivers/gpio/gpiolib-kunit.c
index ad961cf97aee..7798f8a8e602 100644
--- a/drivers/gpio/gpiolib-kunit.c
+++ b/drivers/gpio/gpiolib-kunit.c
@@ -449,6 +449,9 @@ static void gpio_swnode_probe_defer_on_unregistered(struct kunit *test)
pdata = dev_get_platdata(&cons->dev);
KUNIT_ASSERT_EQ(test, pdata->gpio_err, 0);
+
+ /* Tear down the consumer before the provider to free the GPIO. */
+ kunit_platform_device_unregister(test, cons);
}
static int gpio_swnode_probe_order_test_init(struct kunit *test)
@@ -614,9 +617,17 @@ static struct kunit_case gpio_unbind_with_consumers_tests[] = {
{ }
};
+static int gpio_unbind_test_init(struct kunit *test)
+{
+ device_link_wait_removal();
+
+ return 0;
+}
+
static struct kunit_suite gpio_unbind_with_consumers_test_suite = {
.name = "gpio-unbind-with-consumers",
.test_cases = gpio_unbind_with_consumers_tests,
+ .init = gpio_unbind_test_init,
};
kunit_test_suites(
next prev parent reply other threads:[~2026-07-12 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 13:51 [PATCH v3 0/5] software node: provide support for fw_devlink Bartosz Golaszewski
2026-07-10 13:51 ` [PATCH v3 1/5] kunit: provide a set of fwnode-oriented helpers Bartosz Golaszewski
2026-07-11 7:54 ` David Gow
2026-07-10 13:51 ` [PATCH v3 2/5] software node: add fw_devlink support Bartosz Golaszewski
2026-07-11 8:36 ` Andy Shevchenko
2026-07-10 13:51 ` [PATCH v3 3/5] software node: add kunit tests for " Bartosz Golaszewski
2026-07-11 7:54 ` David Gow
2026-07-10 13:51 ` [PATCH v3 4/5] MAINTAINERS: add myself as reviewer of software node support Bartosz Golaszewski
2026-07-10 13:51 ` [PATCH v3 5/5] gpio: kunit: add test cases verifying swnode devlink support Bartosz Golaszewski
2026-07-11 7:54 ` David Gow
2026-07-12 16:59 ` Danilo Krummrich [this message]
2026-07-13 9:45 ` [PATCH v3 0/5] software node: provide support for fw_devlink Bartosz Golaszewski
2026-07-13 10:20 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DJWR3RYAWYAI.LQC41HSN2I94@kernel.org \
--to=dakr@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brendan.higgins@linux.dev \
--cc=brgl@kernel.org \
--cc=david@davidgow.net \
--cc=djrscally@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=kunit-dev@googlegroups.com \
--cc=linusw@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=raemoar63@gmail.com \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox