public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] driver core: Explicitly initialize struct member @data.have_async in __device_attach()
@ 2024-08-23 12:00 Zijun Hu
  2024-08-23 15:55 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Zijun Hu @ 2024-08-23 12:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Dmitry Torokhov
  Cc: Zijun Hu, linux-kernel, Zijun Hu

From: Zijun Hu <quic_zijuhu@quicinc.com>

__device_attach() relies on compiler to implicitly initialize struct
member @data.have_async to avoid the member is used before initialization
but readers may not understand that, solved by explicitly initializing
@data.have_async as well as existing @data.want_async.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
Changes in v2:
- Remove both fix and stable tag
- Correct both title and commit messages
- Link to v1: https://lore.kernel.org/r/20240823-fix_have_async-v1-1-43a354b6614b@quicinc.com
---
 drivers/base/dd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 9b745ba54de1..b0c44b0846aa 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1021,6 +1021,7 @@ static int __device_attach(struct device *dev, bool allow_async)
 			.dev = dev,
 			.check_async = allow_async,
 			.want_async = false,
+			.have_async = false,
 		};
 
 		if (dev->parent)

---
base-commit: 87ee9981d1f86ee9b1623a46c7f9e4ac24461fe4
change-id: 20240823-fix_have_async-3a135618d91b

Best regards,
-- 
Zijun Hu <quic_zijuhu@quicinc.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 12:00 [PATCH v2] driver core: Explicitly initialize struct member @data.have_async in __device_attach() Zijun Hu
2024-08-23 15:55 ` Dmitry Torokhov
2024-08-23 21:12   ` Zijun Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox