Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2022 18:47:07 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f433ed9c5594 - stable/13 - Fix unused variable warning in sctp_timer.c
Message-ID:  <202207291847.26TIl7Dm023684@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=f433ed9c5594e3e349268c741994b72481db1856

commit f433ed9c5594e3e349268c741994b72481db1856
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-25 20:06:28 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-29 18:28:06 +0000

    Fix unused variable warning in sctp_timer.c
    
    With clang 15, the following -Werror warning is produced:
    
        sys/netinet/sctp_timer.c:510:6: error: variable 'recovery_cnt' set but not used [-Werror,-Wunused-but-set-variable]
                int recovery_cnt = 0;
                    ^
    
    The 'recovery_cnt' variable is only used when INVARIANTS is undefined.
    Ensure it is only declared and set in that case.
    
    MFC after:      3 days
    
    (cherry picked from commit 5bfd8cf3691381c19296d76d7944d6c1df5f4a75)
---
 sys/netinet/sctp_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index 17d834cd2734..8481c76f99ca 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -507,7 +507,9 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
 	unsigned int cnt_mk;
 	uint32_t orig_flight, orig_tf;
 	uint32_t tsnlast, tsnfirst;
+#ifndef INVARIANTS
 	int recovery_cnt = 0;
+#endif
 
 	/* none in flight now */
 	audit_tf = 0;
@@ -565,10 +567,10 @@ start_again:
 			/* Strange case our list got out of order? */
 			SCTP_PRINTF("Our list is out of order? last_acked:%x chk:%x\n",
 			    (unsigned int)stcb->asoc.last_acked_seq, (unsigned int)chk->rec.data.tsn);
-			recovery_cnt++;
 #ifdef INVARIANTS
 			panic("last acked >= chk on sent-Q");
 #else
+			recovery_cnt++;
 			SCTP_PRINTF("Recover attempts a restart cnt:%d\n", recovery_cnt);
 			sctp_recover_sent_list(stcb);
 			if (recovery_cnt < 10) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207291847.26TIl7Dm023684>