There are a few of unused variable in mptsas, and the compiler complains about it. Let's get them removed. drivers/message/fusion/mptsas.c:4234:6: warning: variable 'rc' set but not used [-Wunused-but-set-variable] 4234 | int rc; drivers/message/fusion/mptsas.c:4793:17: warning: variable 'timeleft' set but not used [-Wunused-but-set-variable] 4793 | unsigned long timeleft; drivers/message/fusion/mptsas.c:1528:5: warning: variable 'fw_id' set but not used [-Wunused-but-set-variable] 1528 | u8 fw_id; drivers/message/fusion/mptsas.c:4869:9: warning: variable 'termination_count' set but not used [-Wunused-but-set-variable] 4869 | u32 termination_count; drivers/message/fusion/mptsas.c:4870:9: warning: variable 'query_count' set but not used [-Wunused-but-set-variable] 4870 | u32 query_count; Remove those that are unused, and mark others as __maybe_unused, if they are used depending on the logging option. Since scsi_device_reprobe() must have its value checked and it isn't, add a WARN_ON() to let user know if something goes unexpected. Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx> --- Changelog: v2: * Add a warning if scsi_device_reprobe() fails. * Mark query_count and termination_count as __maybe_unused. v1: * https://lore.kernel.org/all/20240807094000.398857-1-leitao@xxxxxxxxxx/ drivers/message/fusion/mptsas.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index a0bcb0864ecd..00a738ef601c 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1447,7 +1447,7 @@ mptsas_add_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info) struct sas_port *port; struct sas_identify identify; char *ds = NULL; - u8 fw_id; + u8 fw_id __maybe_unused; if (!phy_info) { dfailprintk(ioc, printk(MYIOC_s_ERR_FMT @@ -1525,7 +1525,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info) struct mptsas_phyinfo *phy_info_parent; int i; char *ds = NULL; - u8 fw_id; + u8 fw_id __maybe_unused; u64 sas_address; if (!phy_info) @@ -4231,10 +4231,8 @@ mptsas_find_phyinfo_by_phys_disk_num(MPT_ADAPTER *ioc, u8 phys_disk_num, static void mptsas_reprobe_lun(struct scsi_device *sdev, void *data) { - int rc; - sdev->no_uld_attach = data ? 1 : 0; - rc = scsi_device_reprobe(sdev); + WARN_ON(scsi_device_reprobe(sdev)); } static void @@ -4790,7 +4788,6 @@ mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, MPT_FRAME_HDR *mf; SCSITaskMgmt_t *pScsiTm; int retval; - unsigned long timeleft; *issue_reset = 0; mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc); @@ -4826,8 +4823,7 @@ mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf); /* Now wait for the command to complete */ - timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, - timeout*HZ); + wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, timeout * HZ); if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { retval = -1; /* return failure */ dtmprintk(ioc, printk(MYIOC_s_ERR_FMT @@ -4870,8 +4866,8 @@ mptsas_broadcast_primitive_work(struct fw_event_work *fw_event) int task_context; u8 channel, id; int lun; - u32 termination_count; - u32 query_count; + u32 termination_count __maybe_unused; + u32 query_count __maybe_unused; dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s - enter\n", ioc->name, __func__)); -- 2.43.5