git: a21f086a3316 - main - Fix "set but not used" in the tws driver

From: Scott Long <scottl_at_FreeBSD.org>
Date: Fri, 03 Dec 2021 22:40:52 UTC
The branch main has been updated by scottl:

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

commit a21f086a3316346ba04f9381bf10e463a8328394
Author:     Scott Long <scottl@FreeBSD.org>
AuthorDate: 2021-12-03 22:40:29 +0000
Commit:     Scott Long <scottl@FreeBSD.org>
CommitDate: 2021-12-03 22:40:29 +0000

    Fix "set but not used" in the tws driver
    
    Sponsored by: Rubicon Communications, LLC ("Netgate")
---
 sys/dev/tws/tws.c     | 9 ++++-----
 sys/dev/tws/tws_cam.c | 6 ++----
 sys/dev/tws/tws_hdm.c | 2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/sys/dev/tws/tws.c b/sys/dev/tws/tws.c
index a065f7753dee..00446252b2af 100644
--- a/sys/dev/tws/tws.c
+++ b/sys/dev/tws/tws.c
@@ -349,7 +349,7 @@ tws_detach(device_t dev)
 {
     struct tws_softc *sc = device_get_softc(dev);
     int i;
-    u_int32_t reg;
+    u_int32_t reg __diagused;
 
     TWS_TRACE_DEBUG(sc, "entry", 0, 0);
 
@@ -452,11 +452,11 @@ tws_setup_intr(struct tws_softc *sc, int irqs)
 int
 tws_teardown_intr(struct tws_softc *sc)
 {
-    int i, error;
+    int i;
 
     for(i=0;i<sc->irqs;i++) {
         if (sc->intr_handle[i]) {
-            error = bus_teardown_intr(sc->tws_dev,
+            bus_teardown_intr(sc->tws_dev,
                                       sc->irq_res[i], sc->intr_handle[i]);
             sc->intr_handle[i] = NULL;
         }
@@ -509,7 +509,6 @@ tws_init(struct tws_softc *sc)
 
     u_int32_t max_sg_elements;
     u_int32_t dma_mem_size;
-    int error;
     u_int32_t reg;
 
     sc->seq_id = 0;
@@ -569,7 +568,7 @@ tws_init(struct tws_softc *sc)
 
     /* if bus_dmamem_alloc succeeds then bus_dmamap_load will succeed */
     sc->dma_mem_phys=0;
-    error = bus_dmamap_load(sc->cmd_tag, sc->cmd_map, sc->dma_mem,
+    bus_dmamap_load(sc->cmd_tag, sc->cmd_map, sc->dma_mem,
                     dma_mem_size, tws_dmamap_cmds_load_cbfn,
                     &sc->dma_mem_phys, 0);
 
diff --git a/sys/dev/tws/tws_cam.c b/sys/dev/tws/tws_cam.c
index 4e274df45804..7303cce99d50 100644
--- a/sys/dev/tws/tws_cam.c
+++ b/sys/dev/tws/tws_cam.c
@@ -1067,24 +1067,22 @@ tws_intr(void *arg)
 static void
 tws_intr_attn_aen(struct tws_softc *sc)
 {
-    u_int32_t db=0;
 
     /* maskoff db intrs until all the aens are fetched */
     /* tws_disable_db_intr(sc); */
     tws_fetch_aen((void *)sc);
     tws_write_reg(sc, TWS_I2O0_HOBDBC, TWS_BIT18, 4);
-    db = tws_read_reg(sc, TWS_I2O0_IOBDB, 4);
+    (void)tws_read_reg(sc, TWS_I2O0_IOBDB, 4);
 
 }
 
 static void
 tws_intr_attn_error(struct tws_softc *sc)
 {
-    u_int32_t db=0;
 
     TWS_TRACE(sc, "attn error", 0, 0);
     tws_write_reg(sc, TWS_I2O0_HOBDBC, ~0, 4);
-    db = tws_read_reg(sc, TWS_I2O0_IOBDB, 4);
+    (void)tws_read_reg(sc, TWS_I2O0_IOBDB, 4);
     device_printf(sc->tws_dev, "Micro controller error.\n");
     tws_reset(sc);
 }
diff --git a/sys/dev/tws/tws_hdm.c b/sys/dev/tws/tws_hdm.c
index efad88a918a5..11d9320948a0 100644
--- a/sys/dev/tws/tws_hdm.c
+++ b/sys/dev/tws/tws_hdm.c
@@ -82,7 +82,7 @@ void tws_display_ctlr_info(struct tws_softc *sc);
 int 
 tws_init_ctlr(struct tws_softc *sc)
 {
-    u_int64_t reg;
+    u_int64_t reg __diagused;
     u_int32_t regh, regl;
 
     TWS_TRACE_DEBUG(sc, "entry", sc, sc->is64bit);