Skip to contentSkip to conversation

scsi_debug: Remove a set-but-not-used variable

PATCH Superseded Bart Van Assche 2 participants 2 messages May 19 – May 20 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 1515495fd9ea..5ae7e4b83408 100644
@@ -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);
#1 lore raw

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_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 -1
index 1515495fd9ea..5ae7e4b83408 100644
@@ -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 -2
  	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);