Skip to content

Commit b79fafa

Browse files
Joern EngelNicholas Bellinger
authored andcommitted
target: make queue_tm_rsp() return void
The return value wasn't checked by any of the callers. Assuming this is correct behaviour, we can simplify some code by not bothering to generate it. nab: Add srpt_queue_data_in() + srpt_queue_tm_rsp() nops around srpt_queue_response() void return Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 11fee8a commit b79fafa

10 files changed

Lines changed: 28 additions & 28 deletions

File tree

‎drivers/infiniband/ulp/srpt/ib_srpt.c‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)
30113011
* Callback function called by the TCM core. Must not block since it can be
30123012
* invoked on the context of the IB completion handler.
30133013
*/
3014-
static int srpt_queue_response(struct se_cmd *cmd)
3014+
static void srpt_queue_response(struct se_cmd *cmd)
30153015
{
30163016
struct srpt_rdma_ch *ch;
30173017
struct srpt_send_ioctx *ioctx;
@@ -3022,8 +3022,6 @@ static int srpt_queue_response(struct se_cmd *cmd)
30223022
int resp_len;
30233023
u8 srp_tm_status;
30243024

3025-
ret = 0;
3026-
30273025
ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
30283026
ch = ioctx->ch;
30293027
BUG_ON(!ch);
@@ -3049,7 +3047,7 @@ static int srpt_queue_response(struct se_cmd *cmd)
30493047
|| WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) {
30503048
atomic_inc(&ch->req_lim_delta);
30513049
srpt_abort_cmd(ioctx);
3052-
goto out;
3050+
return;
30533051
}
30543052

30553053
dir = ioctx->cmd.data_direction;
@@ -3061,7 +3059,7 @@ static int srpt_queue_response(struct se_cmd *cmd)
30613059
if (ret) {
30623060
printk(KERN_ERR "xfer_data failed for tag %llu\n",
30633061
ioctx->tag);
3064-
goto out;
3062+
return;
30653063
}
30663064
}
30673065

@@ -3082,9 +3080,17 @@ static int srpt_queue_response(struct se_cmd *cmd)
30823080
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
30833081
target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd);
30843082
}
3083+
}
30853084

3086-
out:
3087-
return ret;
3085+
static int srpt_queue_data_in(struct se_cmd *cmd)
3086+
{
3087+
srpt_queue_response(cmd);
3088+
return 0;
3089+
}
3090+
3091+
static void srpt_queue_tm_rsp(struct se_cmd *cmd)
3092+
{
3093+
srpt_queue_response(cmd);
30883094
}
30893095

30903096
static int srpt_queue_status(struct se_cmd *cmd)
@@ -3097,7 +3103,8 @@ static int srpt_queue_status(struct se_cmd *cmd)
30973103
(SCF_TRANSPORT_TASK_SENSE | SCF_EMULATED_TASK_SENSE))
30983104
WARN_ON(cmd->scsi_status != SAM_STAT_CHECK_CONDITION);
30993105
ioctx->queue_status_only = true;
3100-
return srpt_queue_response(cmd);
3106+
srpt_queue_response(cmd);
3107+
return 0;
31013108
}
31023109

31033110
static void srpt_refresh_port_work(struct work_struct *work)
@@ -3930,9 +3937,9 @@ static struct target_core_fabric_ops srpt_template = {
39303937
.set_default_node_attributes = srpt_set_default_node_attrs,
39313938
.get_task_tag = srpt_get_task_tag,
39323939
.get_cmd_state = srpt_get_tcm_cmd_state,
3933-
.queue_data_in = srpt_queue_response,
3940+
.queue_data_in = srpt_queue_data_in,
39343941
.queue_status = srpt_queue_status,
3935-
.queue_tm_rsp = srpt_queue_response,
3942+
.queue_tm_rsp = srpt_queue_tm_rsp,
39363943
/*
39373944
* Setup function pointers for generic logic in
39383945
* target_core_fabric_configfs.c

‎drivers/scsi/qla2xxx/tcm_qla2xxx.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
699699
return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status);
700700
}
701701

702-
static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
702+
static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
703703
{
704704
struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
705705
struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
@@ -731,8 +731,6 @@ static int tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
731731
* CTIO response packet.
732732
*/
733733
qlt_xmit_tm_rsp(mcmd);
734-
735-
return 0;
736734
}
737735

738736
/* Local pointer to allocated TCM configfs fabric module */

‎drivers/target/iscsi/iscsi_target_configfs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,13 +1790,12 @@ static int lio_queue_status(struct se_cmd *se_cmd)
17901790
return 0;
17911791
}
17921792

1793-
static int lio_queue_tm_rsp(struct se_cmd *se_cmd)
1793+
static void lio_queue_tm_rsp(struct se_cmd *se_cmd)
17941794
{
17951795
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
17961796

17971797
cmd->i_state = ISTATE_SEND_TASKMGTRSP;
17981798
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
1799-
return 0;
18001799
}
18011800

18021801
static char *lio_tpg_get_endpoint_wwn(struct se_portal_group *se_tpg)

‎drivers/target/loopback/tcm_loop.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd)
786786
return 0;
787787
}
788788

789-
static int tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
789+
static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
790790
{
791791
struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
792792
struct tcm_loop_tmr *tl_tmr = se_tmr->fabric_tmr_ptr;
@@ -796,7 +796,6 @@ static int tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd)
796796
*/
797797
atomic_set(&tl_tmr->tmr_complete, 1);
798798
wake_up(&tl_tmr->tl_tmr_wait);
799-
return 0;
800799
}
801800

802801
static char *tcm_loop_dump_proto_id(struct tcm_loop_hba *tl_hba)

‎drivers/target/sbp/sbp_target.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,9 +1842,8 @@ static int sbp_queue_status(struct se_cmd *se_cmd)
18421842
return sbp_send_sense(req);
18431843
}
18441844

1845-
static int sbp_queue_tm_rsp(struct se_cmd *se_cmd)
1845+
static void sbp_queue_tm_rsp(struct se_cmd *se_cmd)
18461846
{
1847-
return 0;
18481847
}
18491848

18501849
static int sbp_check_stop_free(struct se_cmd *se_cmd)

‎drivers/target/tcm_fc/tcm_fc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int ft_write_pending(struct se_cmd *);
161161
int ft_write_pending_status(struct se_cmd *);
162162
u32 ft_get_task_tag(struct se_cmd *);
163163
int ft_get_cmd_state(struct se_cmd *);
164-
int ft_queue_tm_resp(struct se_cmd *);
164+
void ft_queue_tm_resp(struct se_cmd *);
165165

166166
/*
167167
* other internal functions.

‎drivers/target/tcm_fc/tfc_cmd.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,14 @@ static void ft_send_tm(struct ft_cmd *cmd)
394394
/*
395395
* Send status from completed task management request.
396396
*/
397-
int ft_queue_tm_resp(struct se_cmd *se_cmd)
397+
void ft_queue_tm_resp(struct se_cmd *se_cmd)
398398
{
399399
struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
400400
struct se_tmr_req *tmr = se_cmd->se_tmr_req;
401401
enum fcp_resp_rsp_codes code;
402402

403403
if (cmd->aborted)
404-
return 0;
404+
return;
405405
switch (tmr->response) {
406406
case TMR_FUNCTION_COMPLETE:
407407
code = FCP_TMF_CMPL;
@@ -421,7 +421,6 @@ int ft_queue_tm_resp(struct se_cmd *se_cmd)
421421
pr_debug("tmr fn %d resp %d fcp code %d\n",
422422
tmr->function, tmr->response, code);
423423
ft_send_resp_code(cmd, code);
424-
return 0;
425424
}
426425

427426
static void ft_send_work(struct work_struct *work);

‎drivers/usb/gadget/tcm_usb_gadget.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,9 +1467,8 @@ static int usbg_get_cmd_state(struct se_cmd *se_cmd)
14671467
return 0;
14681468
}
14691469

1470-
static int usbg_queue_tm_rsp(struct se_cmd *se_cmd)
1470+
static void usbg_queue_tm_rsp(struct se_cmd *se_cmd)
14711471
{
1472-
return 0;
14731472
}
14741473

14751474
static const char *usbg_check_wwn(const char *name)

‎drivers/vhost/scsi.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@ static int tcm_vhost_queue_status(struct se_cmd *se_cmd)
528528
return 0;
529529
}
530530

531-
static int tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
531+
static void tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd)
532532
{
533-
return 0;
533+
return;
534534
}
535535

536536
static void tcm_vhost_free_evt(struct vhost_scsi *vs, struct tcm_vhost_evt *evt)

‎include/target/target_core_fabric.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct target_core_fabric_ops {
6161
int (*get_cmd_state)(struct se_cmd *);
6262
int (*queue_data_in)(struct se_cmd *);
6363
int (*queue_status)(struct se_cmd *);
64-
int (*queue_tm_rsp)(struct se_cmd *);
64+
void (*queue_tm_rsp)(struct se_cmd *);
6565
/*
6666
* fabric module calls for target_core_fabric_configfs.c
6767
*/

0 commit comments

Comments
 (0)