[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250307-fix_faux-v1-1-91459764575e@quicinc.com>
Date: Fri, 07 Mar 2025 20:47:16 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH] driver core: faux: Check device binding state by dedicated
API device_is_bound()
From: Zijun Hu <quic_zijuhu@...cinc.com>
Use dedicated API device_is_bound() instead of 'dev->driver' to check
device binding state in faux_device_create_with_groups().
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/base/faux.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/faux.c b/drivers/base/faux.c
index 407c1d1aad50b7969a6dab9d2027d8beab66a754..76fe494a128254aaaf1339386ab37817a732781f 100644
--- a/drivers/base/faux.c
+++ b/drivers/base/faux.c
@@ -154,7 +154,8 @@ struct faux_device *faux_device_create_with_groups(const char *name,
* if not, let's fail the creation as trying to guess if probe was
* successful is almost impossible to determine by the caller.
*/
- if (!dev->driver) {
+ /* Do not need to device_lock(dev) due to no race here */
+ if (!device_is_bound(dev)) {
dev_err(dev, "probe did not succeed, tearing down the device\n");
faux_device_destroy(faux_dev);
faux_dev = NULL;
---
base-commit: 21b0dc55bed6d9b5dd5d1ad22b75d9d1c7426bbc
change-id: 20250307-fix_faux-0420f1d8eca6
Best regards,
--
Zijun Hu <quic_zijuhu@...cinc.com>
Powered by blists - more mailing lists