Hi Rodney,
I fixed many coverity tool warnings as part of this commit. Adding all the
warnings and fix details seemed over kill.
I will use a better commit message when I do MFC commit of this revision.
Thanks,
Ram
On Thu, Jan 24, 2019 at 12:28 AM Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:
> > Author: ram
> > Date: Wed Jan 23 17:34:01 2019
> > New Revision: 343349
> > URL: https://svnweb.freebsd.org/changeset/base/343349
> >
> > Log:
> > Fixed issues reported by coverity scan.
>
> The quality of this commit message is rather low,
> it should of at least included some details about
> what was wrong, why it was wrong, and how it was
> fixed.
>
> Thanks,
> Rod
> >
> > Approved by: mav
> > MFC after: 3 weeks
> >
> > Modified:
> > head/sys/dev/ocs_fc/ocs_cam.c
> > head/sys/dev/ocs_fc/ocs_hw.c
> > head/sys/dev/ocs_fc/ocs_hw_queues.c
> > head/sys/dev/ocs_fc/ocs_ioctl.c
> > head/sys/dev/ocs_fc/ocs_mgmt.c
> > head/sys/dev/ocs_fc/ocs_node.c
> > head/sys/dev/ocs_fc/ocs_pci.c
> > head/sys/dev/ocs_fc/ocs_xport.c
> > head/sys/dev/ocs_fc/sli4.c
> >
> > Modified: head/sys/dev/ocs_fc/ocs_cam.c
> >
> ==
> > --- head/sys/dev/ocs_fc/ocs_cam.c Wed Jan 23 17:28:39 2019
> (r343348)
> > +++ head/sys/dev/ocs_fc/ocs_cam.c Wed Jan 23 17:34:01 2019
> (r343349)
> > @@ -1164,15 +1164,24 @@ ocs_scsi_del_target(ocs_node_t *node,
> ocs_scsi_del_tar
> > struct ocs_softc *ocs = node->ocs;
> > ocs_fcport *fcp = NULL;
> > ocs_fc_target_t *tgt = NULL;
> > - uint32_ttgt_id;
> > + int32_t tgt_id;
> >
> > + if (ocs == NULL) {
> > + ocs_log_err(ocs,"OCS is NULL \n");
> > + return -1;
> > + }
> > +
> > fcp = node->sport->tgt_data;
> > if (fcp == NULL) {
> > ocs_log_err(ocs,"FCP is NULL \n");
> > - return 0;
> > + return -1;
> > }
> >
> > tgt_id = ocs_tgt_find(fcp, node);
> > + if (tgt_id == -1) {
> > + ocs_log_err(ocs,"target is invalid\n");
> > + return -1;
> > + }
> >
> > tgt = >tgt[tgt_id];
> >
> > @@ -1781,13 +1790,9 @@ ocs_initiator_io(struct ocs_softc *ocs, union ccb
> *ccb
> > ocs_io_t *io = NULL;
> > ocs_scsi_sgl_t sgl[OCS_FC_MAX_SGL];
> > int32_t sgl_count;
> > + ocs_fcport *fcp;
> >
> > - ocs_fcport *fcp = NULL;
> > fcp = FCPORT(ocs, cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)));
> > - if (fcp == NULL) {
> > - device_printf(ocs->dev, "%s: fcp is NULL\n", __func__);
> > - return -1;
> > - }
> >
> > if (fcp->tgt[ccb_h->target_id].state == OCS_TGT_STATE_LOST) {
> > device_printf(ocs->dev, "%s: device LOST %d\n", __func__,
> > @@ -2250,8 +2255,11 @@ ocs_action(struct cam_sim *sim, union ccb *ccb)
> > }
> > case XPT_RESET_BUS:
> > if (ocs_xport_control(ocs->xport, OCS_XPORT_PORT_OFFLINE)
> == 0) {
> > - ocs_xport_control(ocs->xport,
> OCS_XPORT_PORT_ONLINE);
> > -
> > + rc = ocs_xport_control(ocs->xport,
> OCS_XPORT_PORT_ONLINE);
> > + if (rc) {
> > + ocs_log_debug(ocs, "Failed to bring port
> online"
> > + " : %d\n",
> rc);
> > + }
> > ocs_set_ccb_status(ccb, CAM_REQ_CMP);
> > } else {
> > ocs_set_ccb_status(ccb, CAM_REQ_CMP_ERR);
> >
> > Modified: head/sys/dev/ocs_fc/ocs_hw.c
> >
> ==
> > --- head/sys/dev/ocs_fc/ocs_hw.c Wed Jan 23 17:28:39 2019
> (r343348)
> > +++ head/sys/dev/ocs_fc/ocs_hw.c Wed Jan 23 17:34:01 2019
> (r343349)
> > @@ -242,10 +242,7 @@ ocs_hw_get_num_chutes(ocs_hw_t *hw)
> > static ocs_hw_rtn_e
> > ocs_hw_link_event_init(ocs_hw_t *hw)
> > {
> > - if (hw == NULL) {
> > - ocs_log_err(hw->os, "bad parameter hw=%p\n", hw);
> > - return OCS_HW_RTN_ERROR;
> > - }
> > + ocs_hw_assert(hw);
> >
> > hw->link.status = SLI_LINK_STATUS_MAX;
> > hw->link.topology = SLI_LINK_TOPO_NONE;
> > @@ -1757,6 +1754,7 @@ ocs_hw_get(ocs_hw_t *hw, ocs_hw_property_e prop,
> uint3
> > break;
> > case OCS_HW_MAX_VPORTS:
> > *value = sli_get_max_rsrc(>sli, SLI_RSRC_FCOE_VPI);
> > + break;
> > default:
> > ocs_log_test(hw->os, "unsupported property %#x\n", prop);
> > rc = OCS_HW_RTN_ERROR;
> > @@ -1996,6 +1994,7 @@ ocs_hw_set(ocs_hw_t *hw, ocs_hw_property_e prop,
> uint3
> > break;
> > case OCS_ESOC:
> > hw->config.esoc = value;
> > + break;
> > case OCS_HW_HIGH_LOGIN_MODE:
> > rc = sli_set_hlm(>sli, value);
> > break;
> > @@