diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -1003,7 +1003,7 @@ path->bus->sim->max_tagged_dev_openings != 0) { /* Check if the SIM does not want queued commands. */ xpt_path_inq(&cpi, path); - if (cpi.ccb_h.status == CAM_REQ_CMP && + if (cam_ccb_success((union ccb *)&cpi) && (cpi.hba_inquiry & PI_TAG_ABLE)) { /* Report SIM which tags are allowed. */ bzero(&cts, sizeof(cts)); @@ -1481,7 +1481,7 @@ /* If there is PMP... */ if ((scan_info->cpi->hba_inquiry & PI_SATAPM) && (scan_info->counter == scan_info->cpi->max_target)) { - if (work_ccb->ccb_h.status == CAM_REQ_CMP) { + if (cam_ccb_success(work_ccb)) { /* everything else will be probed by it */ /* Free the current request path- we're done with it. */ xpt_free_path(work_ccb->ccb_h.path); diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -1516,6 +1516,12 @@ return ((cam_status)(ccb->ccb_h.status & CAM_STATUS_MASK)); } +static inline bool +cam_ccb_success(union ccb *ccb) +{ + return (cam_ccb_status(ccb) == CAM_REQ_CMP); +} + void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended); static __inline void diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4018,7 +4018,7 @@ xpt_path_inq(&cpi, path); - if (cpi.ccb_h.status == CAM_REQ_CMP) { + if (cam_ccb_success((union ccb *)&cpi)) { struct xpt_xport **xpt; SET_FOREACH(xpt, cam_xpt_xport_set) { diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -441,7 +441,7 @@ */ cam_periph_unlock(periph); cam_periph_unmapmem(ccb, &mapinfo); - error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO; + error = cam_ccb_success(ccb) ? 0 : EIO; out: cam_periph_lock(periph); xpt_release_ccb(ccb); diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -986,7 +986,7 @@ xpt_setup_ccb(&cgd.ccb_h, path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); - if (cgd.ccb_h.status == CAM_REQ_CMP) + if (cam_ccb_success((union ccb *)&cgd)) callback(enc, elm, path, callback_arg); xpt_free_path(path); @@ -1065,7 +1065,7 @@ xpt_action((union ccb *)&cdai); if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); - if (cdai.ccb_h.status == CAM_REQ_CMP) + if (cam_ccb_success((union ccb *)&cdai)) args->num_set++; } xpt_path_unlock(path);