scsi: scsi_transport_fc: remove unused desc_cnt variable

Message ID 20230326003222.1343671-1-trix@redhat.com
State New
Headers
Series scsi: scsi_transport_fc: remove unused desc_cnt variable |

Commit Message

Tom Rix March 26, 2023, 12:32 a.m. UTC
  clang with W=1 reports
drivers/scsi/scsi_transport_fc.c:908:6: error: variable
  'desc_cnt' set but not used [-Werror,-Wunused-but-set-variable]
        u32 desc_cnt = 0, bytes_remain;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/scsi/scsi_transport_fc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Himanshu Madhani March 27, 2023, 6:02 p.m. UTC | #1
> On Mar 25, 2023, at 5:32 PM, Tom Rix <trix@redhat.com> wrote:
> 
> clang with W=1 reports
> drivers/scsi/scsi_transport_fc.c:908:6: error: variable
>  'desc_cnt' set but not used [-Werror,-Wunused-but-set-variable]
>        u32 desc_cnt = 0, bytes_remain;
>            ^
> This variable is not used so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/scsi/scsi_transport_fc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
> index f12e9467ebb4..64ff2629eaf9 100644
> --- a/drivers/scsi/scsi_transport_fc.c
> +++ b/drivers/scsi/scsi_transport_fc.c
> @@ -905,7 +905,7 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
> {
> struct fc_els_fpin *fpin = (struct fc_els_fpin *)fpin_buf;
> struct fc_tlv_desc *tlv;
> - u32 desc_cnt = 0, bytes_remain;
> + u32 bytes_remain;
> u32 dtag;
> enum fc_host_event_code event_code =
> event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN;
> @@ -932,7 +932,6 @@ fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
> fc_fpin_congn_stats_update(shost, tlv);
> }
> 
> - desc_cnt++;
> bytes_remain -= FC_TLV_DESC_SZ_FROM_LENGTH(tlv);
> tlv = fc_tlv_next_desc(tlv);
> }
> -- 
> 2.27.0
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
  
Benjamin Block March 30, 2023, 2:29 p.m. UTC | #2
On Sat, Mar 25, 2023 at 08:32:22PM -0400, Tom Rix wrote:
> clang with W=1 reports
> drivers/scsi/scsi_transport_fc.c:908:6: error: variable
>   'desc_cnt' set but not used [-Werror,-Wunused-but-set-variable]
>         u32 desc_cnt = 0, bytes_remain;
>             ^
> This variable is not used so remove it.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/scsi/scsi_transport_fc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Looks good to me.


Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
  
Martin K. Petersen April 3, 2023, 1:38 a.m. UTC | #3
Tom,

> clang with W=1 reports
> drivers/scsi/scsi_transport_fc.c:908:6: error: variable
>   'desc_cnt' set but not used [-Werror,-Wunused-but-set-variable]
>         u32 desc_cnt = 0, bytes_remain;
>             ^
> This variable is not used so remove it.

Applied to 6.4/scsi-staging, thanks!
  
Martin K. Petersen April 12, 2023, 2:04 a.m. UTC | #4
On Sat, 25 Mar 2023 20:32:22 -0400, Tom Rix wrote:

> clang with W=1 reports
> drivers/scsi/scsi_transport_fc.c:908:6: error: variable
>   'desc_cnt' set but not used [-Werror,-Wunused-but-set-variable]
>         u32 desc_cnt = 0, bytes_remain;
>             ^
> This variable is not used so remove it.
> 
> [...]

Applied to 6.4/scsi-queue, thanks!

[1/1] scsi: scsi_transport_fc: remove unused desc_cnt variable
      https://git.kernel.org/mkp/scsi/c/e324dd00fd17
  

Patch

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index f12e9467ebb4..64ff2629eaf9 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -905,7 +905,7 @@  fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
 {
 	struct fc_els_fpin *fpin = (struct fc_els_fpin *)fpin_buf;
 	struct fc_tlv_desc *tlv;
-	u32 desc_cnt = 0, bytes_remain;
+	u32 bytes_remain;
 	u32 dtag;
 	enum fc_host_event_code event_code =
 		event_acknowledge ? FCH_EVT_LINK_FPIN_ACK : FCH_EVT_LINK_FPIN;
@@ -932,7 +932,6 @@  fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf,
 			fc_fpin_congn_stats_update(shost, tlv);
 		}
 
-		desc_cnt++;
 		bytes_remain -= FC_TLV_DESC_SZ_FROM_LENGTH(tlv);
 		tlv = fc_tlv_next_desc(tlv);
 	}