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
This commit is contained in:
Warner Losh
2025-09-14 11:24:16 -06:00
parent a85adbcd3d
commit 3dfb4e5258
+3 -3
View File
@@ -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) &&