git: ea4e9becc788 - stable/13 - Fix "set but not used" warnings in the mpr driver. This fixes a minor bug in error handling.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Thu, 06 Jan 2022 19:10:36 UTC
The branch stable/13 has been updated by mav:

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

commit ea4e9becc788aaca1a09614631409a2b5970af03
Author:     Scott Long <scottl@FreeBSD.org>
AuthorDate: 2021-11-25 03:28:29 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-01-06 19:08:50 +0000

    Fix "set but not used" warnings in the mpr driver.  This fixes a minor
    bug in error handling.
    
    (cherry picked from commit 61f17c5fd6cfaaf4fa9f543965997022488a29d5)
---
 sys/dev/mpr/mpr_sas.c     | 7 ++-----
 sys/dev/mpr/mpr_sas_lsi.c | 3 ---
 sys/dev/mpr/mpr_table.c   | 2 --
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c
index f0e05f9c886f..9f934e19e763 100644
--- a/sys/dev/mpr/mpr_sas.c
+++ b/sys/dev/mpr/mpr_sas.c
@@ -1229,14 +1229,12 @@ static void
 mprsas_logical_unit_reset_complete(struct mpr_softc *sc, struct mpr_command *tm)
 {
 	MPI2_SCSI_TASK_MANAGE_REPLY *reply;
-	MPI2_SCSI_TASK_MANAGE_REQUEST *req;
 	unsigned int cm_count = 0;
 	struct mpr_command *cm;
 	struct mprsas_target *targ;
 
 	callout_stop(&tm->cm_callout);
 
-	req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
 	reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
 	targ = tm->cm_targ;
 
@@ -1839,10 +1837,11 @@ mprsas_build_nvme_unmap(struct mpr_softc *sc, struct mpr_command *cm,
 	mpr_build_nvme_prp(sc, cm, req,
 	    (void *)(uintptr_t)nvme_dsm_ranges_dma_handle, 0, data_length);
 	mpr_map_command(sc, cm);
+	res = 0;
 
 out:
 	free(plist, M_MPR);
-	return 0;
+	return (res);
 }
 
 static void
@@ -2919,11 +2918,9 @@ mprsas_send_smpcmd(struct mprsas_softc *sassc, union ccb *ccb, uint64_t sasaddr)
 	uint8_t *request, *response;
 	MPI2_SMP_PASSTHROUGH_REQUEST *req;
 	struct mpr_softc *sc;
-	struct sglist *sg;
 	int error;
 
 	sc = sassc->sc;
-	sg = NULL;
 	error = 0;
 
 	switch (ccb->ccb_h.flags & CAM_DATA_MASK) {
diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c
index 025395f6eedd..92b78c5e0d17 100644
--- a/sys/dev/mpr/mpr_sas_lsi.c
+++ b/sys/dev/mpr/mpr_sas_lsi.c
@@ -271,9 +271,6 @@ mprsas_fw_work(struct mpr_softc *sc, struct mpr_fw_event_work *fw_event)
 	}
 	case MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE:
 	{
-		Mpi2EventDataSasEnclDevStatusChange_t *data;
-		data = (Mpi2EventDataSasEnclDevStatusChange_t *)
-		    fw_event->event_data;
 		mpr_mapping_enclosure_dev_status_change_event(sc,
 		    fw_event->event_data);
 		break;
diff --git a/sys/dev/mpr/mpr_table.c b/sys/dev/mpr/mpr_table.c
index 719866b5fa74..7bc629be7335 100644
--- a/sys/dev/mpr/mpr_table.c
+++ b/sys/dev/mpr/mpr_table.c
@@ -541,12 +541,10 @@ mpr_print_sgl(struct mpr_softc *sc, struct mpr_command *cm, int offset)
 	MPI2_IEEE_SGE_SIMPLE64 *ieee_sge;
 	MPI25_IEEE_SGE_CHAIN64 *ieee_sgc;
 	MPI2_SGE_SIMPLE64 *sge;
-	MPI2_REQUEST_HEADER *req;
 	struct mpr_chain *chain = NULL;
 	char *frame;
 	u_int i = 0, flags, length;
 
-	req = (MPI2_REQUEST_HEADER *)cm->cm_req;
 	frame = (char *)cm->cm_req;
 	ieee_sge = (MPI2_IEEE_SGE_SIMPLE64 *)&frame[offset * 4];
 	sge = (MPI2_SGE_SIMPLE64 *)&frame[offset * 4];