diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index eda4dfd6a..562c5e309 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -3726,8 +3726,9 @@ static int scst_cm_release(struct scst_tgt *tgt) static int scst_cm_xmit_response(struct scst_cmd *cmd) { + struct scst_icmd_priv *icmd_priv = cmd->tgt_i_priv; + scst_i_finish_fn_t f = icmd_priv->finish_fn; int res = SCST_TGT_RES_SUCCESS; - scst_i_finish_fn_t f = (void *) *((unsigned long long **)cmd->tgt_i_priv); TRACE_ENTRY(); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 31c8cb443..9e5617d83 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6944,8 +6944,9 @@ out_done: int scst_finish_internal_cmd(struct scst_cmd *cmd) { - int res; + struct scst_icmd_priv *icmd_priv = cmd->tgt_i_priv; unsigned long flags; + int res; TRACE_ENTRY(); @@ -6971,11 +6972,8 @@ int scst_finish_internal_cmd(struct scst_cmd *cmd) if (cmd->cdb[0] == REQUEST_SENSE) scst_complete_request_sense(cmd); - else { - scst_i_finish_fn_t f = (void *) *((unsigned long long **)cmd->tgt_i_priv); - - f(cmd); - } + else + icmd_priv->finish_fn(cmd); __scst_cmd_put(cmd); diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 20756def1..4b30dde37 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -157,6 +157,11 @@ static inline void scst_set_cmd_state(struct scst_cmd *cmd, typedef void (*scst_i_finish_fn_t) (struct scst_cmd *cmd); +/* Private data associated with an internal command. */ +struct scst_icmd_priv { + scst_i_finish_fn_t finish_fn; +}; + extern struct mutex scst_mutex2; extern int scst_threads;