From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>
Cc: 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>,
Andi Shyti <andi.shyti@kernel.org>,
driver-core@lists.linux.dev, linux-acpi@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH v2 7/8] swnode: fix software_node_notify() primary node comment
Date: Tue, 10 Nov 2026 09:51:23 +0100 [thread overview]
Message-ID: <20261110085125.2535508-8-johan@kernel.org> (raw)
In-Reply-To: <20261110085125.2535508-1-johan@kernel.org>
The firmware node pointer in struct device may point to either a primary
or a secondary firmware node and driver core sets the dev pointer of
that node when registering devices.
Fix the comments in software_node_notify() and
software_node_notify_remove() which incorrectly suggest that driver
core only sets the dev pointer of primary firmware nodes.
Fixes: 37e586675993 ("software node: add fw_devlink support")
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/base/swnode.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index a90c20cb84e6..8e12f518e13f 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -1169,8 +1169,8 @@ void software_node_notify(struct device *dev)
return;
/*
- * When the software node is the device's secondary firmware node,
- * the core only records the owning device on the primary fwnode
+ * When a device has both a primary and a secondary firmware node the
+ * core only records the owning device in the primary node
* (see device_add()). fw_devlink resolves a supplier device through
* fwnode->dev, so without this a consumer referencing the software
* node could never find the supplier device and would defer forever.
@@ -1205,9 +1205,8 @@ void software_node_notify_remove(struct device *dev)
sysfs_remove_link(&dev->kobj, "software_node");
/*
- * Drop the device pointer mirrored onto a secondary software node in
- * software_node_notify(). For a primary software node the core owns
- * fwnode->dev and clears it in device_del().
+ * Clear any device pointer set in a secondary software node in
+ * software_node_notify().
*/
if (!device_match_fwnode(dev, &swnode->fwnode) && swnode->fwnode.dev == dev)
swnode->fwnode.dev = NULL;
--
2.56.0
next prev parent reply other threads:[~2026-11-10 8:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 8:51 [PATCH v2 0/8] driver core: platform: fix swnode use-after-free on device release Johan Hovold
2026-11-10 8:51 ` [PATCH v2 1/8] " Johan Hovold
2026-11-10 8:51 ` [PATCH v2 2/8] i2c: core: fix swnode use-after-free on client deregistration Johan Hovold
2026-11-10 10:58 ` Andy Shevchenko
2026-11-10 11:15 ` Johan Hovold
2026-11-10 8:51 ` [PATCH v2 3/8] swnode: fix device_add_of_node() kernel doc Johan Hovold
2026-11-10 10:42 ` Johan Hovold
2026-11-10 11:00 ` Andy Shevchenko
2026-11-10 8:51 ` [PATCH v2 4/8] swnode: ignore primary nodes in device_remove_software_node() Johan Hovold
2026-11-10 11:05 ` Andy Shevchenko
2026-11-10 8:51 ` [PATCH v2 5/8] driver core: platform: warn on bad fwnode assignment Johan Hovold
2026-11-10 10:47 ` Johan Hovold
2026-11-10 8:51 ` [PATCH v2 6/8] driver core: platform: tests: fix swnode reuse test description Johan Hovold
2026-11-10 8:51 ` Johan Hovold [this message]
2026-11-10 8:51 ` [PATCH v2 8/8] device property: fix fwnode_get_next_child_node() comments Johan Hovold
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=20261110085125.2535508-8-johan@kernel.org \
--to=johan@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=djrscally@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.