Remove the unnecessary use of a temporary string buffer.

Sponsored by:	Netflix
This commit is contained in:
scottl 2017-09-09 18:39:55 +00:00
parent e0befa0341
commit 3145ad5e18
4 changed files with 18 additions and 22 deletions

View File

@ -2257,7 +2257,7 @@ mpr_sc_failed_io_info(struct mpr_softc *sc, struct ccb_scsiio *csio,
u8 scsi_status = mpi_reply->SCSIStatus;
char *desc_ioc_state = NULL;
char *desc_scsi_status = NULL;
char *desc_scsi_state = sc->tmp_string;
char *desc_scsi_state = NULL;
u32 log_info = le32toh(mpi_reply->IOCLogInfo);
if (log_info == 0x31170000)
@ -2362,19 +2362,19 @@ mpr_sc_failed_io_info(struct mpr_softc *sc, struct ccb_scsiio *csio,
break;
}
desc_scsi_state[0] = '\0';
desc_scsi_state = "\0";
if (!scsi_state)
desc_scsi_state = " ";
if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
strcat(desc_scsi_state, "response info ");
desc_scsi_state = "response info ";
if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
strcat(desc_scsi_state, "state terminated ");
desc_scsi_state = "state terminated ";
if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS)
strcat(desc_scsi_state, "no status ");
desc_scsi_state = "no status ";
if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED)
strcat(desc_scsi_state, "autosense failed ");
desc_scsi_state = "autosense failed ";
if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
strcat(desc_scsi_state, "autosense valid ");
desc_scsi_state = "autosense valid ";
mpr_dprint(sc, MPR_XINFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x)\n",
le16toh(mpi_reply->DevHandle), desc_ioc_state, ioc_status);
@ -2960,8 +2960,8 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm)
*/
mprsas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
mpr_dprint(sc, MPR_INFO,
"Controller reported %s status for target %u SMID %u, "
"loginfo %x\n", ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
"Controller reported %s target %u SMID %u, loginfo %x\n",
((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_SCSI_IOC_TERMINATED) ? "IOC_TERMINATED" :
"EXT_TERMINATED", target_id, cm->cm_desc.Default.SMID,
le32toh(rep->IOCLogInfo));

View File

@ -74,7 +74,6 @@
#define IFAULT_IOP_OVER_TEMP_THRESHOLD_EXCEEDED 0x2810
#define MPR_SCSI_RI_INVALID_FRAME (0x00000002)
#define MPR_STRING_LENGTH 64
#define DEFAULT_SPINUP_WAIT 3 /* seconds to wait for spinup */
@ -330,7 +329,6 @@ struct mpr_softc {
struct mpr_queue *queues;
struct mprsas_softc *sassc;
char tmp_string[MPR_STRING_LENGTH];
TAILQ_HEAD(, mpr_command) req_list;
TAILQ_HEAD(, mpr_command) high_priority_req_list;
TAILQ_HEAD(, mpr_chain) chain_list;

View File

@ -1987,7 +1987,7 @@ mps_sc_failed_io_info(struct mps_softc *sc, struct ccb_scsiio *csio,
u8 scsi_status = mpi_reply->SCSIStatus;
char *desc_ioc_state = NULL;
char *desc_scsi_status = NULL;
char *desc_scsi_state = sc->tmp_string;
char *desc_scsi_state = NULL;
u32 log_info = le32toh(mpi_reply->IOCLogInfo);
if (log_info == 0x31170000)
@ -2089,19 +2089,19 @@ mps_sc_failed_io_info(struct mps_softc *sc, struct ccb_scsiio *csio,
break;
}
desc_scsi_state[0] = '\0';
desc_scsi_state = "\0";
if (!scsi_state)
desc_scsi_state = " ";
if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID)
strcat(desc_scsi_state, "response info ");
desc_scsi_state = "response info ";
if (scsi_state & MPI2_SCSI_STATE_TERMINATED)
strcat(desc_scsi_state, "state terminated ");
desc_scsi_state = "state terminated ";
if (scsi_state & MPI2_SCSI_STATE_NO_SCSI_STATUS)
strcat(desc_scsi_state, "no status ");
desc_scsi_state = "no status ";
if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_FAILED)
strcat(desc_scsi_state, "autosense failed ");
desc_scsi_state = "autosense failed ";
if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID)
strcat(desc_scsi_state, "autosense valid ");
desc_scsi_state = "autosense valid ";
mps_dprint(sc, MPS_XINFO, "\thandle(0x%04x), ioc_status(%s)(0x%04x)\n",
le16toh(mpi_reply->DevHandle), desc_ioc_state, ioc_status);
@ -2490,8 +2490,8 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
*/
mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
mps_dprint(sc, MPS_INFO,
"Controller reported %s status for target %u SMID %u, "
"loginfo %x\n", ((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
"Controller reported %s target %u SMID %u, loginfo %x\n",
((rep->IOCStatus & MPI2_IOCSTATUS_MASK) ==
MPI2_IOCSTATUS_SCSI_IOC_TERMINATED) ? "IOC_TERMINATED" :
"EXT_TERMINATED", target_id, cm->cm_desc.Default.SMID,
le32toh(rep->IOCLogInfo));

View File

@ -56,7 +56,6 @@
#define MPS_MISSING_CHECK_DELAY 10 /* 10 seconds between missing check */
#define MPS_SCSI_RI_INVALID_FRAME (0x00000002)
#define MPS_STRING_LENGTH 64
#define DEFAULT_SPINUP_WAIT 3 /* seconds to wait for spinup */
@ -317,7 +316,6 @@ struct mps_softc {
struct mps_queue *queues;
struct mpssas_softc *sassc;
char tmp_string[MPS_STRING_LENGTH];
TAILQ_HEAD(, mps_command) req_list;
TAILQ_HEAD(, mps_command) high_priority_req_list;
TAILQ_HEAD(, mps_chain) chain_list;