From e4b0591754be6c370c22df92331ccdd5da89f395 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Wed, 21 Oct 2026 15:02:25 +0300 Subject: [PATCH] scst: Remove unused private helpers and arguments Manual source review found no callers of scst_acg_sess_is_empty(), scst_devt_cleanup(), sgv_pool_sg() or scst_store_sense(). Remove those private definitions and the matching sense-helper declaration. The last sense-helper caller was removed by ae72c4193 after an infinite loop. Also remove the unused local isblank fallback. Preserve scst_zero_write_rest() and its disabled caller for separate debug-code review. These removals are source-review findings, not reported runtime failures. For TTT allocation, remove the unused connection argument from the helper and its sole caller instead of const-qualifying an input it never reads. Cppcheck reports constParameterPointer: Parameter 'conn' can be declared as pointer to const --- iscsi-scst/usr/iscsid.c | 4 ++-- scst/src/scst_lib.c | 29 ----------------------------- scst/src/scst_mem.h | 5 ----- scst/src/scst_pres.c | 4 ---- scst/src/scst_priv.h | 11 ----------- 5 files changed, 2 insertions(+), 51 deletions(-) diff --git a/iscsi-scst/usr/iscsid.c b/iscsi-scst/usr/iscsid.c index ef5e74718..edea333f2 100644 --- a/iscsi-scst/usr/iscsid.c +++ b/iscsi-scst/usr/iscsid.c @@ -32,7 +32,7 @@ int logins_suspended; static u32 ttt; -static u32 get_next_ttt(struct connection *conn __attribute__((unused))) +static u32 get_next_ttt(void) { ttt += 1; return (ttt == ISCSI_RESERVED_TAG) ? ++ttt : ttt; @@ -1295,7 +1295,7 @@ static void cmnd_exec_text(struct connection *conn) goto out; if (!list_empty(&conn->rsp_buf_list) && !list_length_is_one(&conn->rsp_buf_list)) - conn->ttt = get_next_ttt(conn); + conn->ttt = get_next_ttt(); else conn->ttt = ISCSI_RESERVED_TAG; } else if (list_empty(&conn->rsp_buf_list) || conn->ttt != req->ttt) { diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 520176a6f..ebd714ef1 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -14022,35 +14022,6 @@ out: TRACE_EXIT(); } -void scst_store_sense(struct scst_cmd *cmd) -{ - TRACE_ENTRY(); - - if (scst_sense_valid(cmd->sense) && - !test_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags) && - (cmd->tgt_dev != NULL)) { - struct scst_tgt_dev *tgt_dev = cmd->tgt_dev; - - TRACE_DBG("Storing sense (cmd %p)", cmd); - - spin_lock_bh(&tgt_dev->tgt_dev_lock); - - if (cmd->sense_valid_len <= sizeof(tgt_dev->tgt_dev_sense)) - tgt_dev->tgt_dev_valid_sense_len = cmd->sense_valid_len; - else { - tgt_dev->tgt_dev_valid_sense_len = sizeof(tgt_dev->tgt_dev_sense); - PRINT_ERROR("Stored sense truncated to size %d (needed %d)", - tgt_dev->tgt_dev_valid_sense_len, - cmd->sense_valid_len); - } - memcpy(tgt_dev->tgt_dev_sense, cmd->sense, - tgt_dev->tgt_dev_valid_sense_len); - - spin_unlock_bh(&tgt_dev->tgt_dev_lock); - } - - TRACE_EXIT(); -} /* dev_lock supposed to be locked and BHs off */ static void scst_abort_cmds_tgt_dev(struct scst_tgt_dev *tgt_dev, diff --git a/scst/src/scst_mem.h b/scst/src/scst_mem.h index fee8950b2..edee75909 100644 --- a/scst/src/scst_mem.h +++ b/scst/src/scst_mem.h @@ -134,11 +134,6 @@ struct sgv_pool { extern bool scst_force_global_sgv_pool; -static inline struct scatterlist *sgv_pool_sg(struct sgv_pool_obj *obj) -{ - return obj->sg_entries; -} - int __init scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark); void scst_sgv_pools_deinit(void); diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 9a6694a42..a407c0f80 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -68,10 +68,6 @@ #define FILE_BUFFER_SIZE 512 -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif - #if defined(CONFIG_LOCKDEP) #define scst_assert_pr_mutex_held(dev) \ do { \ diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 5fa6aaca5..8bee22f19 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -383,17 +383,10 @@ int scst_acg_add_acn(struct scst_acg *acg, const char *name); void scst_del_free_acn(struct scst_acn *acn, bool reassign); struct scst_acn *scst_find_acn(struct scst_acg *acg, const char *name); -/* The activity supposed to be suspended and scst_mutex held */ -static inline bool scst_acg_sess_is_empty(struct scst_acg *acg) -{ - return list_empty(&acg->acg_sess_list); -} - int scst_prepare_request_sense(struct scst_cmd *orig_cmd); int scst_finish_internal_cmd(struct scst_cmd *cmd); int scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len); -void scst_store_sense(struct scst_cmd *cmd); int scst_process_check_condition(struct scst_cmd *cmd); @@ -431,10 +424,6 @@ void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd); void scst_done_cmd_mgmt(struct scst_cmd *cmd); void scst_finish_cmd_mgmt(struct scst_cmd *cmd); -static inline void scst_devt_cleanup(struct scst_dev_type *devt) -{ -} - void scst_tg_init(void); void scst_tg_cleanup(void); int scst_dg_add(struct kobject *parent, const char *name);