linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: James Bottomley <jejb@linux.ibm.com>
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 24/24] scsi: aic7xxx: aic79xx_osm: Remove set but unused variabes 'saved_scsiid' and 'saved_modes'
Date: Thu, 9 Jul 2020 20:30:55 +0100	[thread overview]
Message-ID: <20200709193055.GA3500@dell> (raw)
In-Reply-To: <1594318443.10411.14.camel@linux.ibm.com>

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

      reply	other threads:[~2020-07-09 19:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 17:45 [PATCH 00/24] Set 3: Fix another set of SCSI related W=1 warnings Lee Jones
2020-07-09 17:45 ` [PATCH 01/24] scsi: aacraid: aachba: Repair two kerneldoc headers Lee Jones
2020-07-09 17:45 ` [PATCH 02/24] scsi: aacraid: commctrl: Fix a few kerneldoc issues Lee Jones
2020-07-09 17:45 ` [PATCH 03/24] scsi: aacraid: dpcsup: Fix logical bug when !DBG Lee Jones
2020-07-09 17:45 ` [PATCH 04/24] scsi: aacraid: dpcsup: Remove unused variable 'status' Lee Jones
2020-07-09 17:45 ` [PATCH 05/24] scsi: aacraid: dpcsup: Demote partially documented function header Lee Jones
2020-07-09 17:45 ` [PATCH 06/24] scsi: aic94xx: aic94xx_seq: Document 'lseq' and repair asd_update_port_links() header Lee Jones
2020-07-09 17:45 ` [PATCH 07/24] scsi: aacraid: commsup: Fix a bunch of function header issues Lee Jones
2020-07-09 17:45 ` [PATCH 08/24] scsi: aic94xx: aic94xx_scb: Fix a couple of formatting and bitrot issues Lee Jones
2020-07-09 17:45 ` [PATCH 09/24] scsi: aacraid: rx: Fill in the very parameter descriptions for rx_sync_cmd() Lee Jones
2020-07-09 17:45 ` [PATCH 10/24] scsi: pm8001: pm8001_ctl: Provide descriptions for the many undocumented 'attr's Lee Jones
2020-07-09 17:45 ` [PATCH 11/24] scsi: ipr: Fix a mountain of kerneldoc misdemeanours Lee Jones
2020-07-09 17:45 ` [PATCH 12/24] scsi: virtio_scsi: Demote seemingly unintentional kerneldoc header Lee Jones
2020-07-09 18:01   ` Paolo Bonzini
2020-07-09 17:45 ` [PATCH 13/24] scsi: ipr: Remove a bunch of set but checked variables Lee Jones
2020-07-09 17:45 ` [PATCH 14/24] scsi: ipr: Fix struct packed-not-aligned issues Lee Jones
2020-07-09 17:45 ` [PATCH 15/24] scsi: myrs: Demote obvious misuse of kerneldoc to standard comment blocks Lee Jones
2020-07-09 17:45 ` [PATCH 16/24] scsi: megaraid: Fix a whole bunch of function header formatting issues Lee Jones
2020-07-16  5:43   ` Chandrakanth Patil
2020-07-09 17:45 ` [PATCH 17/24] scsi: be2iscsi: be_iscsi: Fix API/documentation slip Lee Jones
2020-07-09 17:45 ` [PATCH 18/24] scsi: be2iscsi: be_main: Fix misdocumentation of 'pcontext' Lee Jones
2020-07-09 17:45 ` [PATCH 19/24] scsi: be2iscsi: be_mgmt: Add missing function parameter description Lee Jones
2020-07-09 17:45 ` [PATCH 20/24] scsi: lpfc: lpfc_nvme: Correct some pretty obvious misdocumentation Lee Jones
2020-07-09 17:45 ` [PATCH 21/24] scsi: aic7xxx: aic79xx_osm: Remove unused variable 'ahd' Lee Jones
2020-07-09 17:45 ` [PATCH 22/24] scsi: aic7xxx: aic79xx_osm: Remove unused variables 'wait' and 'paused' Lee Jones
2020-07-09 17:45 ` [PATCH 23/24] scsi: aic7xxx: aic79xx_osm: Fix 'amount_xferred' set but not used issue Lee Jones
2020-07-09 17:45 ` [PATCH 24/24] scsi: aic7xxx: aic79xx_osm: Remove set but unused variabes 'saved_scsiid' and 'saved_modes' Lee Jones
2020-07-09 18:14   ` James Bottomley
2020-07-09 19:30     ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200709193055.GA3500@dell \
    --to=lee.jones@linaro.org \
    --cc=hare@suse.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).