[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240913-fix_have_async-v3-1-793707cfc0d1@quicinc.com>
Date: Fri, 13 Sep 2024 22:05:38 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH v3] driver core: Explicitly initialize struct member
@data.have_async in __device_attach()
From: Zijun Hu <quic_zijuhu@...cinc.com>
__device_attach() defines struct device_attach_data @data as auto
variable and needs to use both @data.want_async and @data.have_async
but it explicitly initializes the former and leaves compiler implicitly
initialize the later, that does not have an elegant look, solved by
explicitly initializing the later member as well that also makes @data
have full initialization.
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
IMO, this change still has a little bit of value as explained below:
- Looks at below similar commit:
Commit: 8f45f5071ad2 ("gpu: host1x: Explicitly initialize host1x_info structures")
- This change's initialization way is obvious better than
struct device_attach_data data = {
.dev = dev,
.check_async = allow_async,
};
which is better than current
struct device_attach_data data = {
.dev = dev,
.check_async = allow_async,
.want_async = false,
};
---
Changes in v3:
- Correct commit message.
- Link to v2: https://lore.kernel.org/r/20240823-fix_have_async-v2-1-ed1039527365@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 a7cc7ff0923b..9e8596773e7f 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: efb0b309fa0d8a92f9b303d292944cda08349eed
change-id: 20240823-fix_have_async-3a135618d91b
Best regards,
--
Zijun Hu <quic_zijuhu@...cinc.com>
Powered by blists - more mailing lists