1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

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
This commit is contained in:
Dimitry Andric 2022-07-25 22:06:28 +02:00
parent 9057feddc4
commit 5bfd8cf369

View File

@ -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 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* 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) {