diff mbox series

[-next] advansys: remove set but not used variable 'srb_tag' in adv_isr_callback

Message ID 20181017123432.18304-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Headers show
Series [-next] advansys: remove set but not used variable 'srb_tag' in adv_isr_callback | expand

Commit Message

Yue Haibing Oct. 17, 2018, 12:34 p.m. UTC
drivers/scsi/advansys.c: In function 'adv_isr_callback':
drivers/scsi/advansys.c:5952:6: warning:
 variable 'srb_tag' set but not used [-Wunused-but-set-variable]

It never used since introduction in
commit 9c17c62aedb0 ("advansys: use shared host tag map for command lookup")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/advansys.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Johannes Thumshirn Oct. 17, 2018, 12:49 p.m. UTC | #1
On 17/10/18 14:34, YueHaibing wrote:
> drivers/scsi/advansys.c: In function 'adv_isr_callback':
> drivers/scsi/advansys.c:5952:6: warning:
>  variable 'srb_tag' set but not used [-Wunused-but-set-variable]
> 
> It never used since introduction in
> commit 9c17c62aedb0 ("advansys: use shared host tag map for command lookup")
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/scsi/advansys.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index 44c9619..223ef6f 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -5949,7 +5949,6 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
>  static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
>  {
>  	struct asc_board *boardp = adv_dvc_varp->drv_ptr;
> -	u32 srb_tag;
>  	adv_req_t *reqp;
>  	adv_sgblk_t *sgblkp;
>  	struct scsi_cmnd *scp;
> @@ -5965,7 +5964,6 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
>  	 * completed. The adv_req_t structure actually contains the
>  	 * completed ADV_SCSI_REQ_Q structure.
>  	 */
> -	srb_tag = le32_to_cpu(scsiqp->srb_tag);
>  	scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);

Shouldn't this be:
	scp = scsi_host_find_tag(boardp->shost,
					le32_to_cpu(scsiqp->srb_tag));
Matthew Wilcox (Oracle) Oct. 17, 2018, 1 p.m. UTC | #2
On Wed, Oct 17, 2018 at 02:49:50PM +0200, Johannes Thumshirn wrote:
> On 17/10/18 14:34, YueHaibing wrote:
> > -	srb_tag = le32_to_cpu(scsiqp->srb_tag);
> >  	scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);
> 
> Shouldn't this be:
> 	scp = scsi_host_find_tag(boardp->shost,
> 					le32_to_cpu(scsiqp->srb_tag));

I don't think so.  Look at how scsiqp->srb_tag is set:

 adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
              ADV_SCSI_REQ_Q **adv_scsiqpp)
 {
+       u32 srb_tag = scp->request->tag;
...
+       scsiqp->srb_tag = srb_tag;

If we're not converting it to le32 on the way in, we probably don't want
to convert it back on the way out.

Please don't make me power up my PA-RISC machine with an Advansys card
in it, just to find out ...
Johannes Thumshirn Oct. 17, 2018, 1:04 p.m. UTC | #3
On 17/10/18 15:00, Matthew Wilcox wrote:
> On Wed, Oct 17, 2018 at 02:49:50PM +0200, Johannes Thumshirn wrote:
>> On 17/10/18 14:34, YueHaibing wrote:
>>> -	srb_tag = le32_to_cpu(scsiqp->srb_tag);
>>>  	scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);
>>
>> Shouldn't this be:
>> 	scp = scsi_host_find_tag(boardp->shost,
>> 					le32_to_cpu(scsiqp->srb_tag));
> 
> I don't think so.  Look at how scsiqp->srb_tag is set:
> 
>  adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
>               ADV_SCSI_REQ_Q **adv_scsiqpp)
>  {
> +       u32 srb_tag = scp->request->tag;
> ...
> +       scsiqp->srb_tag = srb_tag;
> 
> If we're not converting it to le32 on the way in, we probably don't want
> to convert it back on the way out.

Yeah right, didn't check the submission path. It was just the removed
srb_tag = le32_to_cpu(scsiqp->srb_tag);
that triggered here.

> Please don't make me power up my PA-RISC machine with an Advansys card
> in it, just to find out ...

Now that your saying it...
Martin K. Petersen Oct. 18, 2018, 1:02 a.m. UTC | #4
YueHaibing,

> drivers/scsi/advansys.c: In function 'adv_isr_callback':
> drivers/scsi/advansys.c:5952:6: warning:
>  variable 'srb_tag' set but not used [-Wunused-but-set-variable]
>
> It never used since introduction in
> commit 9c17c62aedb0 ("advansys: use shared host tag map for command lookup")

Applied to 4.20/scsi-queue. Thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 44c9619..223ef6f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -5949,7 +5949,6 @@  static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
 static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
 {
 	struct asc_board *boardp = adv_dvc_varp->drv_ptr;
-	u32 srb_tag;
 	adv_req_t *reqp;
 	adv_sgblk_t *sgblkp;
 	struct scsi_cmnd *scp;
@@ -5965,7 +5964,6 @@  static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
 	 * completed. The adv_req_t structure actually contains the
 	 * completed ADV_SCSI_REQ_Q structure.
 	 */
-	srb_tag = le32_to_cpu(scsiqp->srb_tag);
 	scp = scsi_host_find_tag(boardp->shost, scsiqp->srb_tag);
 
 	ASC_DBG(1, "scp 0x%p\n", scp);