Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2022 19:18:03 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: 6e9a64d7ef1e - stable/13 - Fix unused variable warning in icl_soft.c
Message-ID:  <202207271918.26RJI3VO058681@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=6e9a64d7ef1e5ccd0f07bb2471c8bafd261bcd80

commit 6e9a64d7ef1e5ccd0f07bb2471c8bafd261bcd80
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-24 20:54:08 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-27 19:16:22 +0000

    Fix unused variable warning in icl_soft.c
    
    With clang 15, the following -Werror warning is produced:
    
        sys/dev/iscsi//icl_soft.c:886:6: error: variable 'coalesced' set but not used [-Werror,-Wunused-but-set-variable]
                int coalesced, error;
                    ^
    
    The 'coalesced' variable is eventually used only in an #if 0'd block,
    obviously meant for debugging. Ensure that 'coalesced' is only declared
    and used when DEBUG_COALESCED is defined, so the debugging can be easily
    turned on later, if desired.
    
    MFC after:      3 days
    
    (cherry picked from commit f4f847018048ac7699b55bc1915a393eb65e4c53)
---
 sys/dev/iscsi/icl_soft.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 016f70ae9c52..96a4e9d0fa71 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -883,7 +883,10 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
 	struct mbuf *m;
 	struct socket *so;
 	long available, size, size2;
-	int coalesced, error;
+#ifdef DEBUG_COALESCED
+	int coalesced;
+#endif
+	int error;
 
 	ICL_CONN_LOCK_ASSERT_NOT(ic);
 
@@ -942,7 +945,15 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
 		}
 		if (coalesce) {
 			m = request->ip_bhs_mbuf;
-			for (coalesced = 1; ; coalesced++) {
+			for (
+#ifdef DEBUG_COALESCED
+			    coalesced = 1
+#endif
+			    ; ;
+#ifdef DEBUG_COALESCED
+			    coalesced++
+#endif
+			    ) {
 				request2 = STAILQ_FIRST(queue);
 				if (request2 == NULL)
 					break;
@@ -967,7 +978,7 @@ icl_conn_send_pdus(struct icl_soft_conn *isc, struct icl_pdu_stailq *queue)
 				size += size2;
 				icl_soft_pdu_done(request2, 0);
 			}
-#if 0
+#ifdef DEBUG_COALESCED
 			if (coalesced > 1) {
 				ICL_DEBUG("coalesced %d PDUs into %ld bytes",
 				    coalesced, size);



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