aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2025-09-14 17:24:16 +0000
committerWarner Losh <imp@FreeBSD.org>2025-09-14 17:24:16 +0000
commit3dfb4e52587ae692745993a3fee975ad1d3865be (patch)
tree11c3a0bbfde08fffa4c2e959e4722f3e7de69182
parenta85adbcd3dee8d062bf49e1f713e718f59ec0e9f (diff)
mpi3mr: Build with gcc12 by being more explicit about conditions
Help the flow analysis in gcc12 by initializing scsi_reply to NULL and testing it along with sense_buf. Sense buf should be non-null only in this code path, but might also be non-null if the PA for is somehow set to zero. I debated adding an assert for the latter, but opted to instead preserve existing behavior. Also set host_diagnostic to 0. gcc12 can't quite realize that we only test it after we've been through this loop at least once to report an error condition. Initialize to 0 to avoid a diagnostic. Sponsored by: Netflix
-rw-r--r--sys/dev/mpi3mr/mpi3mr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 4211529e76ad..bcf8f46ddf5d 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -4487,7 +4487,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_softc *sc,
Mpi3SuccessReplyDescriptor_t *success_desc;
Mpi3DefaultReply_t *def_reply = NULL;
struct mpi3mr_drvr_cmd *cmdptr = NULL;
- Mpi3SCSIIOReply_t *scsi_reply;
+ Mpi3SCSIIOReply_t *scsi_reply = NULL;
U8 *sense_buf = NULL;
*reply_dma = 0;
@@ -4590,7 +4590,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_softc *sc,
}
}
out:
- if (sense_buf != NULL)
+ if (scsi_reply != NULL && sense_buf != NULL)
mpi3mr_repost_sense_buf(sc,
scsi_reply->SenseDataBufferAddress);
return;
@@ -6162,7 +6162,7 @@ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type,
{
int retval = -1;
U8 unlock_retry_count = 0;
- U32 host_diagnostic, ioc_status, ioc_config, scratch_pad0;
+ U32 host_diagnostic = 0, ioc_status, ioc_config, scratch_pad0;
U32 timeout = MPI3MR_RESET_ACK_TIMEOUT * 10;
if ((reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) &&