git: c154feacc4f2 - main - Fix "set but not used" warnings in CAM.

From: Scott Long <scottl_at_FreeBSD.org>
Date: Thu, 25 Nov 2021 03:20:24 UTC
The branch main has been updated by scottl:

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

commit c154feacc4f2e1dc0858eb93eb1994ea997e699b
Author:     Scott Long <scottl@FreeBSD.org>
AuthorDate: 2021-11-25 03:17:54 +0000
Commit:     Scott Long <scottl@FreeBSD.org>
CommitDate: 2021-11-25 03:17:54 +0000

    Fix "set but not used" warnings in CAM.
---
 sys/cam/cam_sim.c          | 2 +-
 sys/cam/scsi/scsi_da.c     | 2 +-
 sys/cam/scsi/scsi_pt.c     | 5 -----
 sys/cam/scsi/scsi_sg.c     | 7 -------
 sys/cam/scsi/scsi_target.c | 2 --
 5 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c
index abf65965fc8e..2dbf581712f1 100644
--- a/sys/cam/cam_sim.c
+++ b/sys/cam/cam_sim.c
@@ -144,7 +144,7 @@ void
 cam_sim_free(struct cam_sim *sim, int free_devq)
 {
 	struct mtx *mtx;
-	int error;
+	int error __diagused;
 
 	if (sim->mtx == NULL) {
 		mtx = &cam_sim_free_mtx;
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 83e14eca35ab..0bcbccc7eab9 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -5921,7 +5921,7 @@ static void
 dareprobe(struct cam_periph *periph)
 {
 	struct da_softc	  *softc;
-	int status;
+	int status __diagused;
 
 	softc = (struct da_softc *)periph->softc;
 
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 4e7ce9566c59..515bfc4b0aba 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -560,11 +560,6 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb)
 static int
 pterror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
 {
-	struct pt_softc	  *softc;
-	struct cam_periph *periph;
-
-	periph = xpt_path_periph(ccb->ccb_h.path);
-	softc = (struct pt_softc *)periph->softc;
 
 	return(cam_periph_error(ccb, cam_flags, sense_flags));
 }
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index c2be014b118b..c0b2328b0c80 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -405,7 +405,6 @@ sgdone(struct cam_periph *periph, union ccb *done_ccb)
 	case SG_CCB_RDWR_IO:
 	{
 		struct sg_rdwr *rdwr;
-		int state;
 
 		devstat_end_transaction(softc->device_stats,
 					csio->dxfer_len,
@@ -417,7 +416,6 @@ sgdone(struct cam_periph *periph, union ccb *done_ccb)
 					NULL, NULL);
 
 		rdwr = done_ccb->ccb_h.ccb_rdwr;
-		state = rdwr->state;
 		rdwr->state = SG_RDWR_DONE;
 		wakeup(rdwr);
 		break;
@@ -932,11 +930,6 @@ sgsendrdwr(struct cam_periph *periph, union ccb *ccb)
 static int
 sgerror(union ccb *ccb, uint32_t cam_flags, uint32_t sense_flags)
 {
-	struct cam_periph *periph;
-	struct sg_softc *softc;
-
-	periph = xpt_path_periph(ccb->ccb_h.path);
-	softc = (struct sg_softc *)periph->softc;
 
 	return (cam_periph_error(ccb, cam_flags, sense_flags));
 }
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index b743fa2fe9ca..8640067cc531 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -761,13 +761,11 @@ static void
 targdone(struct cam_periph *periph, union ccb *done_ccb)
 {
 	struct targ_softc *softc;
-	cam_status status;
 
 	CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("targdone %p\n", done_ccb));
 	softc = (struct targ_softc *)periph->softc;
 	TAILQ_REMOVE(&softc->pending_ccb_queue, &done_ccb->ccb_h,
 		     periph_links.tqe);
-	status = done_ccb->ccb_h.status & CAM_STATUS_MASK;
 
 	/* If we're no longer enabled, throw away CCB */
 	if ((softc->state & TARG_STATE_LUN_ENABLED) == 0) {