Date: Mon, 02 Feb 2026 22:42:40 +0000 From: Enji Cooper <ngie@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Warner Losh <imp@FreeBSD.org> Subject: git: fc0c9210cca7 - stable/15 - iicbb: Fix gcc12 complaint Message-ID: <69812860.19286.365b2e68@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=fc0c9210cca7a8ed0b3dde92ddbe625dd794ab3c commit fc0c9210cca7a8ed0b3dde92ddbe625dd794ab3c Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-09-14 17:12:38 +0000 Commit: Enji Cooper <ngie@FreeBSD.org> CommitDate: 2026-02-02 22:42:21 +0000 iicbb: Fix gcc12 complaint So gcc12 doesn't understand that t->udelay is >= 1, so thinks that noack might be unset sometimes. While we specifically constrain this on direct assignment, there's a sysctl that might not. This is likely also a bug. Instead of uglifying everything by using MAX(1, sc->udelay), I rewrote the for loop as a do-while loop (which arguably dictates intent better because this code clearly assumes it will be executed once). Sponsored by: Netflix (cherry picked from commit 4b301f7e7ab43bb61561786c2ab33f3a3c4a725d) --- sys/dev/iicbus/iicbb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index c344bda930b0..5f6423135f46 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -331,7 +331,7 @@ iicbb_getack(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); int noack, err; - int t; + int t = 0; /* Release SDA so that the slave can drive it. */ err = iicbb_clockin(dev, 1); @@ -341,12 +341,13 @@ iicbb_getack(device_t dev) } /* Sample SDA until ACK (low) or udelay runs out. */ - for (t = 0; t < sc->udelay; t++) { + do { noack = I2C_GETSDA(dev); if (!noack) break; DELAY(1); - } + t++; + } while(t < sc->udelay); DELAY(sc->udelay - t); iicbb_clockout(dev);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69812860.19286.365b2e68>
