scsi_debug: Remove a set-but-not-used variable
PATCH 1/1 scsi_debug: Remove a set-but-not-used variable
The static variable sdebug_any_injecting_opt is no longer read. Commit 3a90a63d02b8 ("scsi: scsi_debug: every_nth triggered error injection") removed all code that reads this variable. Hence, also remove this variable itself. This has been detected by building the scsi_debug driver with the git HEAD version of Clang and with W=1.
--- drivers/scsi/scsi_debug.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/scsi_debug.c +0 -4
@@ -955,7 +955,6 @@ static bool sdebug_removable = DEF_REMOVABLE;static bool sdebug_clustering;static bool sdebug_host_lock =DEF_HOST_LOCK ;static bool sdebug_strict =DEF_STRICT ; -static bool sdebug_any_injecting_opt;static bool sdebug_no_rwlock;static bool sdebug_verbose;static bool have_dif_prot;
@@ -7528,7 +7527,6 @@ static int scsi_debug_write_info(struct Scsi_Host *host, char *buffer,return -EINVAL ; sdebug_opts = opts; sdebug_verbose = !!(SDEBUG_OPT_NOISE & opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & opts);if (sdebug_every_nth !=0 )tweak_cmnd_count ();return length;
@@ -7748,7 +7746,6 @@ static ssize_t opts_store(struct device_driver *ddp, const char *buf, opts_done: sdebug_opts = opts; sdebug_verbose = !!(SDEBUG_OPT_NOISE & opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & opts);tweak_cmnd_count ();return count; }
@@ -9659,7 +9656,6 @@ static int sdebug_driver_probe(struct device *dev)scsi_host_set_guard (hpnt,SHOST_DIX_GUARD_CRC ); sdebug_verbose = !!(SDEBUG_OPT_NOISE & sdebug_opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & sdebug_opts);if (sdebug_every_nth)/* need stats counters for every_nth */ sdebug_statistics = true; error =scsi_add_host (hpnt, &sdbg_host->dev);
On 19/05/2026 20:41, Bart Van Assche wrote:
how about a more precise subject, like "scsi_debug: Remove sdebug_any_injecting_opt"?
Quoted 24 lines
The static variable
sdebug_any_injecting_optis no longer read. Commit3a90a63d02b8("scsi:scsi_debug:every_nthtriggered error injection") removed all code that reads this variable. Hence, also remove this variable itself. This has been detected by building thescsi_debugdriver with the git HEAD version of Clang and with W=1.Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/scsi_debug.c | 4 ---- 1 file changed, 4 deletions(-)drivers/scsi/scsi_debug.c +0
-1@@ -955,7 +955,6 @@ static bool sdebug_removable = DEF_REMOVABLE;static bool sdebug_clustering;static bool sdebug_host_lock =DEF_HOST_LOCK ;static bool sdebug_strict =DEF_STRICT ; -static bool sdebug_any_injecting_opt;static bool sdebug_no_rwlock;static bool sdebug_verbose;static bool have_dif_prot;
drivers/scsi/scsi_debug.c static int scsi_debug_write_info(struct Scsi_Host *host, char *buffer, · line 7531
Quoted 4 lines
drivers/scsi/scsi_debug.c +0
-1@@ -7528,7 +7527,6 @@ static int scsi_debug_write_info(struct Scsi_Host *host, char *buffer,return -EINVAL ; sdebug_opts = opts; sdebug_verbose = !!(SDEBUG_OPT_NOISE & opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & opts);
I think that SDEBUG_OPT_ALL_INJECTING can also be deleted as it would no longer be referenced
Quoted 20 lines
drivers/scsi/scsi_debug.c +0
-2if (sdebug_every_nth !=0 )tweak_cmnd_count ();return length;@@ -7748,7 +7746,6 @@ static ssize_t opts_store(struct device_driver *ddp, const char *buf, opts_done: sdebug_opts = opts; sdebug_verbose = !!(SDEBUG_OPT_NOISE & opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & opts);tweak_cmnd_count ();return count; }@@ -9659,7 +9656,6 @@ static int sdebug_driver_probe(struct device *dev)scsi_host_set_guard (hpnt,SHOST_DIX_GUARD_CRC ); sdebug_verbose = !!(SDEBUG_OPT_NOISE & sdebug_opts); - sdebug_any_injecting_opt = !!(SDEBUG_OPT_ALL_INJECTING & sdebug_opts);if (sdebug_every_nth)/* need stats counters for every_nth */ sdebug_statistics = true; error =scsi_add_host (hpnt, &sdbg_host->dev);