From: Herve Codina <herve.codina@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Saravana Kannan <saravanak@google.com>
Cc: linux-kernel@vger.kernel.org,
Allan Nielsen <allan.nielsen@microchip.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>,
Steen Hegelund <steen.hegelund@microchip.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Herve Codina <herve.codina@bootlin.com>,
stable@vger.kernel.org
Subject: [PATCH 1/1] driver core: Remove warning on driver unbinding
Date: Fri, 10 Nov 2023 09:02:40 +0100 [thread overview]
Message-ID: <20231110080241.702999-1-herve.codina@bootlin.com> (raw)
During driver unbinding, __device_links_no_driver() can raise the
following warning:
--- 8< ---
WARNING: CPU: 0 PID: 166 at drivers/base/core.c:1426 __device_links_no_driver+0xac/0xb4
...
Call trace:
__device_links_no_driver+0xac/0xb4
device_links_driver_cleanup+0xa8/0xf0
device_release_driver_internal+0x204/0x240
device_release_driver+0x18/0x24
bus_remove_device+0xcc/0x10c
device_del+0x158/0x414
platform_device_del.part.0+0x1c/0x88
platform_device_unregister+0x24/0x40
of_platform_device_destroy+0xfc/0x10c
device_for_each_child_reverse+0x64/0xb4
devm_of_platform_populate_release+0x4c/0x84
release_nodes+0x5c/0x90
devres_release_all+0x8c/0xdc
device_unbind_cleanup+0x18/0x68
device_release_driver_internal+0x20c/0x240
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xf0/0x240
driver_detach+0x50/0x9c
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
...
--- 8< ---
This warning is raised because, during device removal, we unlink a
consumer while its supplier links.status is DL_DEV_UNBINDING.
Even if the link is not a SYNC_STATE_ONLY, the warning should not
appear in that case.
Filter out this warning in case of the supplier driver is unbinding.
Fixes: 8c3e315d4296 ("driver core: Update device link status correctly for SYNC_STATE_ONLY links")
Cc: stable@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
drivers/base/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 17f2568e0a79..f4b09691998e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1423,7 +1423,8 @@ static void __device_links_no_driver(struct device *dev)
if (link->supplier->links.status == DL_DEV_DRIVER_BOUND) {
WRITE_ONCE(link->status, DL_STATE_AVAILABLE);
} else {
- WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY));
+ WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY) &&
+ link->supplier->links.status != DL_DEV_UNBINDING);
WRITE_ONCE(link->status, DL_STATE_DORMANT);
}
}
--
2.41.0
next reply other threads:[~2023-11-10 17:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 8:02 Herve Codina [this message]
2023-11-11 1:42 ` [PATCH 1/1] driver core: Remove warning on driver unbinding Saravana Kannan
2023-11-13 17:57 ` Herve Codina
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=20231110080241.702999-1-herve.codina@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=allan.nielsen@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=horatiu.vultur@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=saravanak@google.com \
--cc=stable@vger.kernel.org \
--cc=steen.hegelund@microchip.com \
--cc=thomas.petazzoni@bootlin.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.