diff mbox series

scsi: qla2xxx: fix excluded_middle.cocci warnings

Message ID 20220920024554.2606-1-hanyihao@vivo.com (mailing list archive)
State Rejected
Headers show
Series scsi: qla2xxx: fix excluded_middle.cocci warnings | expand

Commit Message

Yihao Han Sept. 20, 2022, 2:45 a.m. UTC
Condition !A || A && B is equivalent to !A || B.

Generated by: scripts/coccinelle/misc/excluded_middle.cocci
Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

kernel test robot Sept. 20, 2022, 7:09 a.m. UTC | #1
Hi Yihao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.0-rc6 next-20220919]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20220920/202209201406.fHVcccRp-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
        git checkout 81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/scsi/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_target.c: In function 'qlt_free_session_done':
>> drivers/scsi/qla2xxx/qla_target.c:1031:78: error: expected ')' before '{' token
    1031 |                     (!own || (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
         |                                                                              ^~
         |                                                                              )
   drivers/scsi/qla2xxx/qla_target.c:1030:20: note: to match this '('
    1030 |                 if (ha->flags.edif_enabled &&
         |                    ^
>> drivers/scsi/qla2xxx/qla_target.c:1047:9: error: expected expression before '}' token
    1047 |         }
         |         ^


vim +1031 drivers/scsi/qla2xxx/qla_target.c

   961	
   962	void qlt_free_session_done(struct work_struct *work)
   963	{
   964		struct fc_port *sess = container_of(work, struct fc_port,
   965		    free_work);
   966		struct qla_tgt *tgt = sess->tgt;
   967		struct scsi_qla_host *vha = sess->vha;
   968		struct qla_hw_data *ha = vha->hw;
   969		unsigned long flags;
   970		bool logout_started = false;
   971		scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
   972		struct qlt_plogi_ack_t *own =
   973			sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
   974	
   975		ql_dbg(ql_dbg_disc, vha, 0xf084,
   976			"%s: se_sess %p / sess %p from port %8phC loop_id %#04x"
   977			" s_id %02x:%02x:%02x logout %d keep %d els_logo %d\n",
   978			__func__, sess->se_sess, sess, sess->port_name, sess->loop_id,
   979			sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa,
   980			sess->logout_on_delete, sess->keep_nport_handle,
   981			sess->send_els_logo);
   982	
   983		if (!IS_SW_RESV_ADDR(sess->d_id)) {
   984			qla2x00_mark_device_lost(vha, sess, 0);
   985	
   986			if (sess->send_els_logo) {
   987				qlt_port_logo_t logo;
   988	
   989				logo.id = sess->d_id;
   990				logo.cmd_count = 0;
   991				INIT_LIST_HEAD(&logo.list);
   992				if (!own)
   993					qlt_send_first_logo(vha, &logo);
   994				sess->send_els_logo = 0;
   995			}
   996	
   997			if (sess->logout_on_delete && sess->loop_id != FC_NO_LOOP_ID) {
   998				int rc;
   999	
  1000				if (!own ||
  1001				     (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
  1002					sess->logout_completed = 0;
  1003					rc = qla2x00_post_async_logout_work(vha, sess,
  1004					    NULL);
  1005					if (rc != QLA_SUCCESS)
  1006						ql_log(ql_log_warn, vha, 0xf085,
  1007						    "Schedule logo failed sess %p rc %d\n",
  1008						    sess, rc);
  1009					else
  1010						logout_started = true;
  1011				} else if (own && (own->iocb.u.isp24.status_subcode ==
  1012					ELS_PRLI) && ha->flags.rida_fmt2) {
  1013					rc = qla2x00_post_async_prlo_work(vha, sess,
  1014					    NULL);
  1015					if (rc != QLA_SUCCESS)
  1016						ql_log(ql_log_warn, vha, 0xf085,
  1017						    "Schedule PRLO failed sess %p rc %d\n",
  1018						    sess, rc);
  1019					else
  1020						logout_started = true;
  1021				}
  1022			} /* if sess->logout_on_delete */
  1023	
  1024			if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
  1025			    !(sess->nvme_flag & NVME_FLAG_DELETING)) {
  1026				sess->nvme_flag |= NVME_FLAG_DELETING;
  1027				qla_nvme_unregister_remote_port(sess);
  1028			}
  1029	
  1030			if (ha->flags.edif_enabled &&
> 1031			    (!own || (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
  1032				sess->edif.authok = 0;
  1033				if (!ha->flags.host_shutting_down) {
  1034					ql_dbg(ql_dbg_edif, vha, 0x911e,
  1035					       "%s wwpn %8phC calling qla2x00_release_all_sadb\n",
  1036					       __func__, sess->port_name);
  1037					qla2x00_release_all_sadb(vha, sess);
  1038				} else {
  1039					ql_dbg(ql_dbg_edif, vha, 0x911e,
  1040					       "%s bypassing release_all_sadb\n",
  1041					       __func__);
  1042				}
  1043	
  1044				qla_edif_clear_appdata(vha, sess);
  1045				qla_edif_sess_down(vha, sess);
  1046			}
> 1047		}
  1048	
  1049		/*
  1050		 * Release the target session for FC Nexus from fabric module code.
  1051		 */
  1052		if (sess->se_sess != NULL)
  1053			ha->tgt.tgt_ops->free_session(sess);
  1054	
  1055		if (logout_started) {
  1056			bool traced = false;
  1057			u16 cnt = 0;
  1058	
  1059			while (!READ_ONCE(sess->logout_completed)) {
  1060				if (!traced) {
  1061					ql_dbg(ql_dbg_disc, vha, 0xf086,
  1062						"%s: waiting for sess %p logout\n",
  1063						__func__, sess);
  1064					traced = true;
  1065				}
  1066				msleep(100);
  1067				cnt++;
  1068				/*
  1069				 * Driver timeout is set to 22 Sec, update count value to loop
  1070				 * long enough for log-out to complete before advancing. Otherwise,
  1071				 * straddling logout can interfere with re-login attempt.
  1072				 */
  1073				if (cnt > 230)
  1074					break;
  1075			}
  1076	
  1077			ql_dbg(ql_dbg_disc, vha, 0xf087,
  1078			    "%s: sess %p logout completed\n", __func__, sess);
  1079		}
  1080	
  1081		if (sess->logo_ack_needed) {
  1082			sess->logo_ack_needed = 0;
  1083			qla24xx_async_notify_ack(vha, sess,
  1084				(struct imm_ntfy_from_isp *)sess->iocb, SRB_NACK_LOGO);
  1085		}
  1086	
  1087		spin_lock_irqsave(&vha->work_lock, flags);
  1088		sess->flags &= ~FCF_ASYNC_SENT;
  1089		spin_unlock_irqrestore(&vha->work_lock, flags);
  1090	
  1091		spin_lock_irqsave(&ha->tgt.sess_lock, flags);
  1092		if (sess->se_sess) {
  1093			sess->se_sess = NULL;
  1094			if (tgt && !IS_SW_RESV_ADDR(sess->d_id))
  1095				tgt->sess_count--;
  1096		}
  1097	
  1098		qla2x00_set_fcport_disc_state(sess, DSC_DELETED);
  1099		sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
  1100		sess->deleted = QLA_SESS_DELETED;
  1101	
  1102		if (sess->login_succ && !IS_SW_RESV_ADDR(sess->d_id)) {
  1103			vha->fcport_count--;
  1104			sess->login_succ = 0;
  1105		}
  1106	
  1107		qla2x00_clear_loop_id(sess);
  1108	
  1109		if (sess->conflict) {
  1110			sess->conflict->login_pause = 0;
  1111			sess->conflict = NULL;
  1112			if (!test_bit(UNLOADING, &vha->dpc_flags))
  1113				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
  1114		}
  1115	
  1116		{
  1117			struct qlt_plogi_ack_t *con =
  1118			    sess->plogi_link[QLT_PLOGI_LINK_CONFLICT];
  1119			struct imm_ntfy_from_isp *iocb;
  1120	
  1121			own = sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
  1122	
  1123			if (con) {
  1124				iocb = &con->iocb;
  1125				ql_dbg(ql_dbg_tgt_mgt, vha, 0xf099,
  1126					 "se_sess %p / sess %p port %8phC is gone,"
  1127					 " %s (ref=%d), releasing PLOGI for %8phC (ref=%d)\n",
  1128					 sess->se_sess, sess, sess->port_name,
  1129					 own ? "releasing own PLOGI" : "no own PLOGI pending",
  1130					 own ? own->ref_count : -1,
  1131					 iocb->u.isp24.port_name, con->ref_count);
  1132				qlt_plogi_ack_unref(vha, con);
  1133				sess->plogi_link[QLT_PLOGI_LINK_CONFLICT] = NULL;
  1134			} else {
  1135				ql_dbg(ql_dbg_tgt_mgt, vha, 0xf09a,
  1136				    "se_sess %p / sess %p port %8phC is gone, %s (ref=%d)\n",
  1137				    sess->se_sess, sess, sess->port_name,
  1138				    own ? "releasing own PLOGI" :
  1139				    "no own PLOGI pending",
  1140				    own ? own->ref_count : -1);
  1141			}
  1142	
  1143			if (own) {
  1144				sess->fw_login_state = DSC_LS_PLOGI_PEND;
  1145				qlt_plogi_ack_unref(vha, own);
  1146				sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] = NULL;
  1147			}
  1148		}
  1149	
  1150		sess->explicit_logout = 0;
  1151		spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
  1152		sess->free_pending = 0;
  1153	
  1154		qla2x00_dfs_remove_rport(vha, sess);
  1155	
  1156		ql_dbg(ql_dbg_disc, vha, 0xf001,
  1157		    "Unregistration of sess %p %8phC finished fcp_cnt %d\n",
  1158			sess, sess->port_name, vha->fcport_count);
  1159	
  1160		if (tgt && (tgt->sess_count == 0))
  1161			wake_up_all(&tgt->waitQ);
  1162	
  1163		if (!test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags) &&
  1164		    !(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)) &&
  1165		    (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) {
  1166			switch (vha->host->active_mode) {
  1167			case MODE_INITIATOR:
  1168			case MODE_DUAL:
  1169				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
  1170				qla2xxx_wake_dpc(vha);
  1171				break;
  1172			case MODE_TARGET:
  1173			default:
  1174				/* no-op */
  1175				break;
  1176			}
  1177		}
  1178	
  1179		if (vha->fcport_count == 0)
  1180			wake_up_all(&vha->fcport_waitQ);
  1181	}
  1182
kernel test robot Sept. 21, 2022, 5:31 a.m. UTC | #2
Hi Yihao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.0-rc6 next-20220920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-a006-20220919 (https://download.01.org/0day-ci/archive/20220921/202209211330.Evw4tUuR-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
        git checkout 81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/scsi/qla2xxx/qla_target.c:1031:65: error: expected ')'
                       (!own || (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
                                                                                 ^
   drivers/scsi/qla2xxx/qla_target.c:1030:6: note: to match this '('
                   if (ha->flags.edif_enabled &&
                      ^
>> drivers/scsi/qla2xxx/qla_target.c:1047:2: error: expected statement
           }
           ^
   2 errors generated.


vim +1031 drivers/scsi/qla2xxx/qla_target.c

   961	
   962	void qlt_free_session_done(struct work_struct *work)
   963	{
   964		struct fc_port *sess = container_of(work, struct fc_port,
   965		    free_work);
   966		struct qla_tgt *tgt = sess->tgt;
   967		struct scsi_qla_host *vha = sess->vha;
   968		struct qla_hw_data *ha = vha->hw;
   969		unsigned long flags;
   970		bool logout_started = false;
   971		scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
   972		struct qlt_plogi_ack_t *own =
   973			sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
   974	
   975		ql_dbg(ql_dbg_disc, vha, 0xf084,
   976			"%s: se_sess %p / sess %p from port %8phC loop_id %#04x"
   977			" s_id %02x:%02x:%02x logout %d keep %d els_logo %d\n",
   978			__func__, sess->se_sess, sess, sess->port_name, sess->loop_id,
   979			sess->d_id.b.domain, sess->d_id.b.area, sess->d_id.b.al_pa,
   980			sess->logout_on_delete, sess->keep_nport_handle,
   981			sess->send_els_logo);
   982	
   983		if (!IS_SW_RESV_ADDR(sess->d_id)) {
   984			qla2x00_mark_device_lost(vha, sess, 0);
   985	
   986			if (sess->send_els_logo) {
   987				qlt_port_logo_t logo;
   988	
   989				logo.id = sess->d_id;
   990				logo.cmd_count = 0;
   991				INIT_LIST_HEAD(&logo.list);
   992				if (!own)
   993					qlt_send_first_logo(vha, &logo);
   994				sess->send_els_logo = 0;
   995			}
   996	
   997			if (sess->logout_on_delete && sess->loop_id != FC_NO_LOOP_ID) {
   998				int rc;
   999	
  1000				if (!own ||
  1001				     (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
  1002					sess->logout_completed = 0;
  1003					rc = qla2x00_post_async_logout_work(vha, sess,
  1004					    NULL);
  1005					if (rc != QLA_SUCCESS)
  1006						ql_log(ql_log_warn, vha, 0xf085,
  1007						    "Schedule logo failed sess %p rc %d\n",
  1008						    sess, rc);
  1009					else
  1010						logout_started = true;
  1011				} else if (own && (own->iocb.u.isp24.status_subcode ==
  1012					ELS_PRLI) && ha->flags.rida_fmt2) {
  1013					rc = qla2x00_post_async_prlo_work(vha, sess,
  1014					    NULL);
  1015					if (rc != QLA_SUCCESS)
  1016						ql_log(ql_log_warn, vha, 0xf085,
  1017						    "Schedule PRLO failed sess %p rc %d\n",
  1018						    sess, rc);
  1019					else
  1020						logout_started = true;
  1021				}
  1022			} /* if sess->logout_on_delete */
  1023	
  1024			if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
  1025			    !(sess->nvme_flag & NVME_FLAG_DELETING)) {
  1026				sess->nvme_flag |= NVME_FLAG_DELETING;
  1027				qla_nvme_unregister_remote_port(sess);
  1028			}
  1029	
  1030			if (ha->flags.edif_enabled &&
> 1031			    (!own || (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
  1032				sess->edif.authok = 0;
  1033				if (!ha->flags.host_shutting_down) {
  1034					ql_dbg(ql_dbg_edif, vha, 0x911e,
  1035					       "%s wwpn %8phC calling qla2x00_release_all_sadb\n",
  1036					       __func__, sess->port_name);
  1037					qla2x00_release_all_sadb(vha, sess);
  1038				} else {
  1039					ql_dbg(ql_dbg_edif, vha, 0x911e,
  1040					       "%s bypassing release_all_sadb\n",
  1041					       __func__);
  1042				}
  1043	
  1044				qla_edif_clear_appdata(vha, sess);
  1045				qla_edif_sess_down(vha, sess);
  1046			}
> 1047		}
  1048	
  1049		/*
  1050		 * Release the target session for FC Nexus from fabric module code.
  1051		 */
  1052		if (sess->se_sess != NULL)
  1053			ha->tgt.tgt_ops->free_session(sess);
  1054	
  1055		if (logout_started) {
  1056			bool traced = false;
  1057			u16 cnt = 0;
  1058	
  1059			while (!READ_ONCE(sess->logout_completed)) {
  1060				if (!traced) {
  1061					ql_dbg(ql_dbg_disc, vha, 0xf086,
  1062						"%s: waiting for sess %p logout\n",
  1063						__func__, sess);
  1064					traced = true;
  1065				}
  1066				msleep(100);
  1067				cnt++;
  1068				/*
  1069				 * Driver timeout is set to 22 Sec, update count value to loop
  1070				 * long enough for log-out to complete before advancing. Otherwise,
  1071				 * straddling logout can interfere with re-login attempt.
  1072				 */
  1073				if (cnt > 230)
  1074					break;
  1075			}
  1076	
  1077			ql_dbg(ql_dbg_disc, vha, 0xf087,
  1078			    "%s: sess %p logout completed\n", __func__, sess);
  1079		}
  1080	
  1081		if (sess->logo_ack_needed) {
  1082			sess->logo_ack_needed = 0;
  1083			qla24xx_async_notify_ack(vha, sess,
  1084				(struct imm_ntfy_from_isp *)sess->iocb, SRB_NACK_LOGO);
  1085		}
  1086	
  1087		spin_lock_irqsave(&vha->work_lock, flags);
  1088		sess->flags &= ~FCF_ASYNC_SENT;
  1089		spin_unlock_irqrestore(&vha->work_lock, flags);
  1090	
  1091		spin_lock_irqsave(&ha->tgt.sess_lock, flags);
  1092		if (sess->se_sess) {
  1093			sess->se_sess = NULL;
  1094			if (tgt && !IS_SW_RESV_ADDR(sess->d_id))
  1095				tgt->sess_count--;
  1096		}
  1097	
  1098		qla2x00_set_fcport_disc_state(sess, DSC_DELETED);
  1099		sess->fw_login_state = DSC_LS_PORT_UNAVAIL;
  1100		sess->deleted = QLA_SESS_DELETED;
  1101	
  1102		if (sess->login_succ && !IS_SW_RESV_ADDR(sess->d_id)) {
  1103			vha->fcport_count--;
  1104			sess->login_succ = 0;
  1105		}
  1106	
  1107		qla2x00_clear_loop_id(sess);
  1108	
  1109		if (sess->conflict) {
  1110			sess->conflict->login_pause = 0;
  1111			sess->conflict = NULL;
  1112			if (!test_bit(UNLOADING, &vha->dpc_flags))
  1113				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
  1114		}
  1115	
  1116		{
  1117			struct qlt_plogi_ack_t *con =
  1118			    sess->plogi_link[QLT_PLOGI_LINK_CONFLICT];
  1119			struct imm_ntfy_from_isp *iocb;
  1120	
  1121			own = sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN];
  1122	
  1123			if (con) {
  1124				iocb = &con->iocb;
  1125				ql_dbg(ql_dbg_tgt_mgt, vha, 0xf099,
  1126					 "se_sess %p / sess %p port %8phC is gone,"
  1127					 " %s (ref=%d), releasing PLOGI for %8phC (ref=%d)\n",
  1128					 sess->se_sess, sess, sess->port_name,
  1129					 own ? "releasing own PLOGI" : "no own PLOGI pending",
  1130					 own ? own->ref_count : -1,
  1131					 iocb->u.isp24.port_name, con->ref_count);
  1132				qlt_plogi_ack_unref(vha, con);
  1133				sess->plogi_link[QLT_PLOGI_LINK_CONFLICT] = NULL;
  1134			} else {
  1135				ql_dbg(ql_dbg_tgt_mgt, vha, 0xf09a,
  1136				    "se_sess %p / sess %p port %8phC is gone, %s (ref=%d)\n",
  1137				    sess->se_sess, sess, sess->port_name,
  1138				    own ? "releasing own PLOGI" :
  1139				    "no own PLOGI pending",
  1140				    own ? own->ref_count : -1);
  1141			}
  1142	
  1143			if (own) {
  1144				sess->fw_login_state = DSC_LS_PLOGI_PEND;
  1145				qlt_plogi_ack_unref(vha, own);
  1146				sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] = NULL;
  1147			}
  1148		}
  1149	
  1150		sess->explicit_logout = 0;
  1151		spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
  1152		sess->free_pending = 0;
  1153	
  1154		qla2x00_dfs_remove_rport(vha, sess);
  1155	
  1156		ql_dbg(ql_dbg_disc, vha, 0xf001,
  1157		    "Unregistration of sess %p %8phC finished fcp_cnt %d\n",
  1158			sess, sess->port_name, vha->fcport_count);
  1159	
  1160		if (tgt && (tgt->sess_count == 0))
  1161			wake_up_all(&tgt->waitQ);
  1162	
  1163		if (!test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags) &&
  1164		    !(vha->vp_idx && test_bit(VPORT_DELETE, &vha->dpc_flags)) &&
  1165		    (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) {
  1166			switch (vha->host->active_mode) {
  1167			case MODE_INITIATOR:
  1168			case MODE_DUAL:
  1169				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
  1170				qla2xxx_wake_dpc(vha);
  1171				break;
  1172			case MODE_TARGET:
  1173			default:
  1174				/* no-op */
  1175				break;
  1176			}
  1177		}
  1178	
  1179		if (vha->fcport_count == 0)
  1180			wake_up_all(&vha->fcport_waitQ);
  1181	}
  1182
kernel test robot Sept. 22, 2022, 11:13 p.m. UTC | #3
Hi Yihao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v6.0-rc6 next-20220921]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: microblaze-randconfig-r032-20220922 (https://download.01.org/0day-ci/archive/20220923/202209230711.vQKIDdtE-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yihao-Han/scsi-qla2xxx-fix-excluded_middle-cocci-warnings/20220920-104643
        git checkout 81672bb39d1900d22e851a7cfb0b9a0aa35df8af
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/scsi/qla2xxx/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_target.c: In function 'qlt_free_session_done':
>> drivers/scsi/qla2xxx/qla_target.c:7409:2: error: unterminated argument list invoking macro "if"
    7409 | }
         |  ^
>> drivers/scsi/qla2xxx/qla_target.c:7410: error: expected '(' at end of input
   drivers/scsi/qla2xxx/qla_target.c:1030:17: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
    1030 |                 if (ha->flags.edif_enabled &&
         |                 ^~
   drivers/scsi/qla2xxx/qla_target.c:1030:17: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
>> drivers/scsi/qla2xxx/qla_target.c:1030:17: error: expected declaration or statement at end of input
>> drivers/scsi/qla2xxx/qla_target.c:1030:17: error: expected declaration or statement at end of input
   drivers/scsi/qla2xxx/qla_target.c:971:26: warning: unused variable 'base_vha' [-Wunused-variable]
     971 |         scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
         |                          ^~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:970:14: warning: variable 'logout_started' set but not used [-Wunused-but-set-variable]
     970 |         bool logout_started = false;
         |              ^~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:969:23: warning: unused variable 'flags' [-Wunused-variable]
     969 |         unsigned long flags;
         |                       ^~~~~
   drivers/scsi/qla2xxx/qla_target.c:966:25: warning: unused variable 'tgt' [-Wunused-variable]
     966 |         struct qla_tgt *tgt = sess->tgt;
         |                         ^~~
   drivers/scsi/qla2xxx/qla_target.c: At top level:
>> drivers/scsi/qla2xxx/qla_target.c:101:13: warning: 'qlt_24xx_atio_pkt' used but never defined
     101 | static void qlt_24xx_atio_pkt(struct scsi_qla_host *ha,
         |             ^~~~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:103:13: warning: 'qlt_response_pkt' used but never defined
     103 | static void qlt_response_pkt(struct scsi_qla_host *ha, struct rsp_que *rsp,
         |             ^~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:105:12: warning: 'qlt_issue_task_mgmt' declared 'static' but never defined [-Wunused-function]
     105 | static int qlt_issue_task_mgmt(struct fc_port *sess, u64 lun,
         |            ^~~~~~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:107:13: warning: 'qlt_send_term_exchange' used but never defined
     107 | static void qlt_send_term_exchange(struct qla_qpair *, struct qla_tgt_cmd
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:109:13: warning: 'qlt_alloc_qfull_cmd' declared 'static' but never defined [-Wunused-function]
     109 | static void qlt_alloc_qfull_cmd(struct scsi_qla_host *vha,
         |             ^~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:111:13: warning: 'qlt_disable_vha' declared 'static' but never defined [-Wunused-function]
     111 | static void qlt_disable_vha(struct scsi_qla_host *vha);
         |             ^~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:112:13: warning: 'qlt_clear_tgt_db' declared 'static' but never defined [-Wunused-function]
     112 | static void qlt_clear_tgt_db(struct qla_tgt *tgt);
         |             ^~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:113:13: warning: 'qlt_send_notify_ack' declared 'static' but never defined [-Wunused-function]
     113 | static void qlt_send_notify_ack(struct qla_qpair *qpair,
         |             ^~~~~~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:117:13: warning: 'qlt_send_term_imm_notif' used but never defined
     117 | static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
         |             ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:119:24: warning: 'qlt_create_sess' used but never defined
     119 | static struct fc_port *qlt_create_sess(struct scsi_qla_host *vha,
         |                        ^~~~~~~~~~~~~~~
>> drivers/scsi/qla2xxx/qla_target.c:122:13: warning: 'qlt_24xx_handle_abts' used but never defined
     122 | static void qlt_24xx_handle_abts(struct scsi_qla_host *,
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:124:13: warning: 'qlt_send_busy' declared 'static' but never defined [-Wunused-function]
     124 | static void qlt_send_busy(struct qla_qpair *, struct atio_from_isp *,
         |             ^~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:126:12: warning: 'qlt_check_reserve_free_req' declared 'static' but never defined [-Wunused-function]
     126 | static int qlt_check_reserve_free_req(struct qla_qpair *qpair, uint32_t);
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:127:24: warning: 'qlt_make_handle' declared 'static' but never defined [-Wunused-function]
     127 | static inline uint32_t qlt_make_handle(struct qla_qpair *);
         |                        ^~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:793:1: warning: 'qlt_plogi_ack_find_add' defined but not used [-Wunused-function]
     793 | qlt_plogi_ack_find_add(struct scsi_qla_host *vha, port_id_t *id,
         | ^~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:332:13: warning: 'qlt_24xx_atio_pkt_all_vps' defined but not used [-Wunused-function]
     332 | static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:139:20: warning: 'prot_op_str' defined but not used [-Wunused-function]
     139 | static const char *prot_op_str(u32 prot_op)
         |                    ^~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:135:33: warning: 'qla_tgt_wq' defined but not used [-Wunused-variable]
     135 | static struct workqueue_struct *qla_tgt_wq;
         |                                 ^~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:134:19: warning: 'qla_tgt_mgmt_cmd_mempool' defined but not used [-Wunused-variable]
     134 | static mempool_t *qla_tgt_mgmt_cmd_mempool;
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:132:27: warning: 'qla_tgt_mgmt_cmd_cachep' defined but not used [-Wunused-variable]
     132 | static struct kmem_cache *qla_tgt_mgmt_cmd_cachep;
         |                           ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:61:12: warning: 'tc_sam_status' defined but not used [-Wunused-variable]
      61 | static int tc_sam_status = SAM_STAT_TASK_SET_FULL; /* target core */
         |            ^~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_target.c:60:12: warning: 'qla_sam_status' defined but not used [-Wunused-variable]
      60 | static int qla_sam_status = SAM_STAT_BUSY;
         |            ^~~~~~~~~~~~~~


vim +/if +7409 drivers/scsi/qla2xxx/qla_target.c

2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7399  
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7400  void qlt_exit(void)
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7401  {
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7402  	if (!QLA_TGT_MODE_ENABLED())
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7403  		return;
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7404  
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7405  	destroy_workqueue(qla_tgt_wq);
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7406  	mempool_destroy(qla_tgt_mgmt_cmd_mempool);
b7bd104e6f1c3be Alexei Potashnik   2015-12-17  7407  	kmem_cache_destroy(qla_tgt_plogi_cachep);
2d70c103fd2a066 Nicholas Bellinger 2012-05-15  7408  	kmem_cache_destroy(qla_tgt_mgmt_cmd_cachep);
2d70c103fd2a066 Nicholas Bellinger 2012-05-15 @7409  }
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index bb754a950802..c2e1ed4b7909 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1028,8 +1028,7 @@  void qlt_free_session_done(struct work_struct *work)
 		}
 
 		if (ha->flags.edif_enabled &&
-		    (!own || (own &&
-			      own->iocb.u.isp24.status_subcode == ELS_PLOGI))) {
+		    (!own || (own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
 			sess->edif.authok = 0;
 			if (!ha->flags.host_shutting_down) {
 				ql_dbg(ql_dbg_edif, vha, 0x911e,