git: 850203655b7d - main - thunderbolt: Fix v2.0 reset to reliably wait for the reset to finish
John Baldwin <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a876752.27f7a.778fbefe__48563.7147956126$1787258741$gmane$org@gitrepo.freebsd.org> |
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=850203655b7d25d7309601a32b44011a21e850c6 commit 850203655b7d25d7309601a32b44011a21e850c6 Author: John Baldwin <[email protected]> AuthorDate: 2026-08-20 19:49:36 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2026-08-20 19:49:36 +0000 thunderbolt: Fix v2.0 reset to reliably wait for the reset to finish The `reg` value was never initialized, so the loop could potentially abort without a single read of the register. This was found by the following warning from GCC: sys/dev/thunderbolt/nhi.c: In function 'nhi_reset_v2': sys/dev/thunderbolt/nhi.c:272:35: error: 'reg' is used uninitialized [-Werror=uninitialized] 272 | for (size_t i = 0; i < 10 && reg; i++) { | ^~ sys/dev/thunderbolt/nhi.c:257:18: note: 'reg' was declared here 257 | uint32_t reg; | ^~~ Reported by: GCC 15 Fixes: efdb82413963 ("thunderbolt: Reset controllers") --- sys/dev/thunderbolt/nhi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/thunderbolt/nhi.c b/sys/dev/thunderbolt/nhi.c index 22427cf324fb..e8221136a8e5 100644 --- a/sys/dev/thunderbolt/nhi.c +++ b/sys/dev/thunderbolt/nhi.c @@ -269,6 +269,7 @@ nhi_reset_v2(struct nhi_softc *sc) * "The Host Router is required to complete its reset within 500ms * after the Host Router Reset bit is set to 1b." */ + reg = 1; for (size_t i = 0; i < 10 && reg; i++) { /* * Wait at least 50 ms after writing before reading this