Message ID | 20200709174556.7651-25-lee.jones@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | Set 3: Fix another set of SCSI related W=1 warnings | expand |
On Thu, 2020-07-09 at 18:45 +0100, Lee Jones wrote: > Haven't been used since 2006. > > Fixes the following W=1 kernel build warning(s): > > drivers/scsi/aic7xxx/aic79xx_osm.c: In function > ‘ahd_linux_queue_abort_cmd’: > drivers/scsi/aic7xxx/aic79xx_osm.c:2155:17: warning: variable > ‘saved_modes’ set but not used [-Wunused-but-set-variable] > drivers/scsi/aic7xxx/aic79xx_osm.c:2148:9: warning: variable > ‘saved_scsiid’ set but not used [-Wunused-but-set-variable] > > Cc: Hannes Reinecke <hare@suse.com> > Signed-off-by: Lee Jones <lee.jones@linaro.org> > --- > drivers/scsi/aic7xxx/aic79xx_osm.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c > b/drivers/scsi/aic7xxx/aic79xx_osm.c > index 3782a20d58885..b0c6701f64a83 100644 > --- a/drivers/scsi/aic7xxx/aic79xx_osm.c > +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c > @@ -2141,14 +2141,12 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > *cmd) > u_int saved_scbptr; > u_int active_scbptr; > u_int last_phase; > - u_int saved_scsiid; > u_int cdb_byte; > int retval; > int was_paused; > int paused; > int wait; > int disconnected; > - ahd_mode_state saved_modes; > unsigned long flags; > > pending_scb = NULL; > @@ -2239,7 +2237,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > *cmd) > goto done; > } > > - saved_modes = ahd_save_modes(ahd); > + ahd_save_modes(ahd); Well, this is clearly wrong, since ahd_save_modes has no side effects. However, I think it also means there's a bug in this code: > ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); You can't do this without later restoring the mode, so someone needs to figure out where the missing ahd_restore_modes() should go. > last_phase = ahd_inb(ahd, LASTPHASE); > saved_scbptr = ahd_get_scbptr(ahd); > @@ -2257,7 +2255,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > *cmd) > * passed in command. That command is currently active on > the > * bus or is in the disconnected state. > */ > - saved_scsiid = ahd_inb(ahd, SAVED_SCSIID); > + ahd_inb(ahd, SAVED_SCSIID); I think this can just go. James
On Thu, 09 Jul 2020, James Bottomley wrote: > On Thu, 2020-07-09 at 18:45 +0100, Lee Jones wrote: > > Haven't been used since 2006. > > > > Fixes the following W=1 kernel build warning(s): > > > > drivers/scsi/aic7xxx/aic79xx_osm.c: In function > > ‘ahd_linux_queue_abort_cmd’: > > drivers/scsi/aic7xxx/aic79xx_osm.c:2155:17: warning: variable > > ‘saved_modes’ set but not used [-Wunused-but-set-variable] > > drivers/scsi/aic7xxx/aic79xx_osm.c:2148:9: warning: variable > > ‘saved_scsiid’ set but not used [-Wunused-but-set-variable] > > > > Cc: Hannes Reinecke <hare@suse.com> > > Signed-off-by: Lee Jones <lee.jones@linaro.org> > > --- > > drivers/scsi/aic7xxx/aic79xx_osm.c | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c > > b/drivers/scsi/aic7xxx/aic79xx_osm.c > > index 3782a20d58885..b0c6701f64a83 100644 > > --- a/drivers/scsi/aic7xxx/aic79xx_osm.c > > +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c > > @@ -2141,14 +2141,12 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > > *cmd) > > u_int saved_scbptr; > > u_int active_scbptr; > > u_int last_phase; > > - u_int saved_scsiid; > > u_int cdb_byte; > > int retval; > > int was_paused; > > int paused; > > int wait; > > int disconnected; > > - ahd_mode_state saved_modes; > > unsigned long flags; > > > > pending_scb = NULL; > > @@ -2239,7 +2237,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > > *cmd) > > goto done; > > } > > > > - saved_modes = ahd_save_modes(ahd); > > + ahd_save_modes(ahd); > > Well, this is clearly wrong, since ahd_save_modes has no side effects. Great. Thanks for letting me know. I tend to err on the side of caution with these types of fix-ups. I will remove it. > However, I think it also means there's a bug in this code: > > > ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); > > You can't do this without later restoring the mode, so someone needs to > figure out where the missing ahd_restore_modes() should go. > > > last_phase = ahd_inb(ahd, LASTPHASE); > > saved_scbptr = ahd_get_scbptr(ahd); > > @@ -2257,7 +2255,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd > > *cmd) > > * passed in command. That command is currently active on > > the > > * bus or is in the disconnected state. > > */ > > - saved_scsiid = ahd_inb(ahd, SAVED_SCSIID); > > + ahd_inb(ahd, SAVED_SCSIID); > > I think this can just go. Happy to remove it also. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 3782a20d58885..b0c6701f64a83 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -2141,14 +2141,12 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) u_int saved_scbptr; u_int active_scbptr; u_int last_phase; - u_int saved_scsiid; u_int cdb_byte; int retval; int was_paused; int paused; int wait; int disconnected; - ahd_mode_state saved_modes; unsigned long flags; pending_scb = NULL; @@ -2239,7 +2237,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) goto done; } - saved_modes = ahd_save_modes(ahd); + ahd_save_modes(ahd); ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); last_phase = ahd_inb(ahd, LASTPHASE); saved_scbptr = ahd_get_scbptr(ahd); @@ -2257,7 +2255,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) * passed in command. That command is currently active on the * bus or is in the disconnected state. */ - saved_scsiid = ahd_inb(ahd, SAVED_SCSIID); + ahd_inb(ahd, SAVED_SCSIID); if (last_phase != P_BUSFREE && SCB_GET_TAG(pending_scb) == active_scbptr) {
Haven't been used since 2006. Fixes the following W=1 kernel build warning(s): drivers/scsi/aic7xxx/aic79xx_osm.c: In function ‘ahd_linux_queue_abort_cmd’: drivers/scsi/aic7xxx/aic79xx_osm.c:2155:17: warning: variable ‘saved_modes’ set but not used [-Wunused-but-set-variable] drivers/scsi/aic7xxx/aic79xx_osm.c:2148:9: warning: variable ‘saved_scsiid’ set but not used [-Wunused-but-set-variable] Cc: Hannes Reinecke <hare@suse.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/scsi/aic7xxx/aic79xx_osm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.25.1