2021-07-14 09:19:20

by Bill Wendling

[permalink] [raw]
Subject: [PATCH 0/3] Fix clang -Wunused-but-set-variable warnings

These patches clean up warnings from clang's '-Wunused-but-set-variable' flag.

Bill Wendling (3):
base: remove unused variable 'no_warn'
bnx2x: remove unused variable 'cur_data_offset'
scsi: qla2xxx: remove unused variable 'status'

drivers/base/module.c | 6 ++----
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 6 ------
drivers/scsi/qla2xxx/qla_nx.c | 2 --
3 files changed, 2 insertions(+), 12 deletions(-)

--
2.32.0.93.g670b81a890-goog


2021-07-14 09:19:42

by Bill Wendling

[permalink] [raw]
Subject: [PATCH 2/3] bnx2x: remove unused variable 'cur_data_offset'

Fix the clang build warning:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:1862:13: error: variable 'cur_data_offset' set but not used [-Werror,-Wunused-but-set-variable]
dma_addr_t cur_data_offset;

Signed-off-by: Bill Wendling <[email protected]>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 27943b0446c2..f255fd0b16db 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -1858,7 +1858,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
{
int i;
int first_queue_query_index, num_queues_req;
- dma_addr_t cur_data_offset;
struct stats_query_entry *cur_query_entry;
u8 stats_count = 0;
bool is_fcoe = false;
@@ -1879,10 +1878,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
BNX2X_NUM_ETH_QUEUES(bp), is_fcoe, first_queue_query_index,
first_queue_query_index + num_queues_req);

- cur_data_offset = bp->fw_stats_data_mapping +
- offsetof(struct bnx2x_fw_stats_data, queue_stats) +
- num_queues_req * sizeof(struct per_queue_stats);
-
cur_query_entry = &bp->fw_stats_req->
query[first_queue_query_index + num_queues_req];

@@ -1933,7 +1928,6 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp)
cur_query_entry->funcID,
j, cur_query_entry->index);
cur_query_entry++;
- cur_data_offset += sizeof(struct per_queue_stats);
stats_count++;

/* all stats are coalesced to the leading queue */
--
2.32.0.93.g670b81a890-goog

2021-07-14 09:20:32

by Bill Wendling

[permalink] [raw]
Subject: [PATCH 3/3] scsi: qla2xxx: remove unused variable 'status'

Fix the clang build warning:

drivers/scsi/qla2xxx/qla_nx.c:2209:6: error: variable 'status' set but not used [-Werror,-Wunused-but-set-variable]
int status = 0;

Signed-off-by: Bill Wendling <[email protected]>
---
drivers/scsi/qla2xxx/qla_nx.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 615e44af1ca6..11aad97dfca8 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2166,7 +2166,6 @@ qla82xx_poll(int irq, void *dev_id)
struct qla_hw_data *ha;
struct rsp_que *rsp;
struct device_reg_82xx __iomem *reg;
- int status = 0;
uint32_t stat;
uint32_t host_int = 0;
uint16_t mb[8];
@@ -2195,7 +2194,6 @@ qla82xx_poll(int irq, void *dev_id)
case 0x10:
case 0x11:
qla82xx_mbx_completion(vha, MSW(stat));
- status |= MBX_INTERRUPT;
break;
case 0x12:
mb[0] = MSW(stat);
--
2.32.0.93.g670b81a890-goog

2021-07-26 20:21:15

by Bill Wendling

[permalink] [raw]
Subject: [PATCH v2 0/3] Fix clang -Wunused-but-set-variable warnings

These patches clean up warnings from clang's '-Wunused-but-set-variable' flag.

Changes for v2:
- Mark "no_warn" as "__maybe_unused" to avoid separate warning.

Bill Wendling (3):
base: mark 'no_warn' as unused
bnx2x: remove unused variable 'cur_data_offset'
scsi: qla2xxx: remove unused variable 'status'

drivers/base/module.c | 2 +-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 6 ------
drivers/scsi/qla2xxx/qla_nx.c | 2 --
3 files changed, 1 insertion(+), 9 deletions(-)

--
2.32.0.432.gabb21c7263-goog

2021-07-26 20:23:03

by Bill Wendling

[permalink] [raw]
Subject: [PATCH v2 3/3] scsi: qla2xxx: remove unused variable 'status'

Fix the clang build warning:

drivers/scsi/qla2xxx/qla_nx.c:2209:6: error: variable 'status' set but not used [-Werror,-Wunused-but-set-variable]
int status = 0;

Signed-off-by: Bill Wendling <[email protected]>
---
drivers/scsi/qla2xxx/qla_nx.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 615e44af1ca6..11aad97dfca8 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2166,7 +2166,6 @@ qla82xx_poll(int irq, void *dev_id)
struct qla_hw_data *ha;
struct rsp_que *rsp;
struct device_reg_82xx __iomem *reg;
- int status = 0;
uint32_t stat;
uint32_t host_int = 0;
uint16_t mb[8];
@@ -2195,7 +2194,6 @@ qla82xx_poll(int irq, void *dev_id)
case 0x10:
case 0x11:
qla82xx_mbx_completion(vha, MSW(stat));
- status |= MBX_INTERRUPT;
break;
case 0x12:
mb[0] = MSW(stat);
--
2.32.0.432.gabb21c7263-goog

2021-07-26 20:42:12

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] scsi: qla2xxx: remove unused variable 'status'

On 7/26/2021 1:19 PM, 'Bill Wendling' via Clang Built Linux wrote:
> Fix the clang build warning:
>
> drivers/scsi/qla2xxx/qla_nx.c:2209:6: error: variable 'status' set but not used [-Werror,-Wunused-but-set-variable]
> int status = 0;
>
> Signed-off-by: Bill Wendling <[email protected]>

It has been unused since the function's introduction in commit
a9083016a531 ("[SCSI] qla2xxx: Add ISP82XX support.").

Reviewed-by: Nathan Chancellor <[email protected]>

> ---
> drivers/scsi/qla2xxx/qla_nx.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
> index 615e44af1ca6..11aad97dfca8 100644
> --- a/drivers/scsi/qla2xxx/qla_nx.c
> +++ b/drivers/scsi/qla2xxx/qla_nx.c
> @@ -2166,7 +2166,6 @@ qla82xx_poll(int irq, void *dev_id)
> struct qla_hw_data *ha;
> struct rsp_que *rsp;
> struct device_reg_82xx __iomem *reg;
> - int status = 0;
> uint32_t stat;
> uint32_t host_int = 0;
> uint16_t mb[8];
> @@ -2195,7 +2194,6 @@ qla82xx_poll(int irq, void *dev_id)
> case 0x10:
> case 0x11:
> qla82xx_mbx_completion(vha, MSW(stat));
> - status |= MBX_INTERRUPT;
> break;
> case 0x12:
> mb[0] = MSW(stat);
>

2021-07-27 03:17:43

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] scsi: qla2xxx: remove unused variable 'status'


Bill,

> Fix the clang build warning:
>
> drivers/scsi/qla2xxx/qla_nx.c:2209:6: error: variable 'status' set but not used [-Werror,-Wunused-but-set-variable]
> int status = 0;

Applied to 5.15/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2021-07-29 03:42:59

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] Fix clang -Wunused-but-set-variable warnings

On Mon, 26 Jul 2021 13:19:21 -0700, Bill Wendling wrote:

> These patches clean up warnings from clang's '-Wunused-but-set-variable' flag.
>
> Changes for v2:
> - Mark "no_warn" as "__maybe_unused" to avoid separate warning.
>
> Bill Wendling (3):
> base: mark 'no_warn' as unused
> bnx2x: remove unused variable 'cur_data_offset'
> scsi: qla2xxx: remove unused variable 'status'
>
> [...]

Applied to 5.15/scsi-queue, thanks!

[3/3] scsi: qla2xxx: remove unused variable 'status'
https://git.kernel.org/mkp/scsi/c/cb51bcd5c34b

--
Martin K. Petersen Oracle Linux Engineering