[PATCH v2] driver core: Explicitly initialize struct member @data.have_async in __device_attach()
From: Zijun Hu
Date: Fri Aug 23 2024 - 08:00:57 EST
From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
__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@xxxxxxxxxxx>
---
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@xxxxxxxxxxx
---
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@xxxxxxxxxxx>