diff mbox series

RDMA/rxe: Avoid unused variable warnings on 32-bit targets

Message ID 20221215232837.30211-1-palmer@rivosinc.com (mailing list archive)
State Rejected
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/rxe: Avoid unused variable warnings on 32-bit targets | expand

Commit Message

Palmer Dabbelt Dec. 15, 2022, 11:28 p.m. UTC
From: Palmer Dabbelt <palmer@rivosinc.com>

These variables are not used on 32-bit targets as there's a big ifdef
around their use.  This results on a handful of warnings for 32-bit
RISC-V allyesconfig:

  CC      drivers/infiniband/sw/rxe/rxe_resp.o
linux/drivers/infiniband/sw/rxe/rxe_resp.c: In function 'atomic_write_reply':
linux/drivers/infiniband/sw/rxe/rxe_resp.c:794:13: error: unused variable 'payload' [-Werror=unused-variable]
  794 |         int payload = payload_size(pkt);
      |             ^~~~~~~
linux/drivers/infiniband/sw/rxe/rxe_resp.c:793:24: error: unused variable 'mr' [-Werror=unused-variable]
  793 |         struct rxe_mr *mr = qp->resp.mr;
      |                        ^~
linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:19: error: unused variable 'dst' [-Werror=unused-variable]
  791 |         u64 src, *dst;
      |                   ^~~
linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:13: error: unused variable 'src' [-Werror=unused-variable]
  791 |         u64 src, *dst;
      |             ^~~
cc1: all warnings being treated as errors

Fixes: 034e285f8b99 ("RDMA/rxe: Make responder support atomic write on RC service")
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
 drivers/infiniband/sw/rxe/rxe_resp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Zhu Yanjun Dec. 16, 2022, 3:11 a.m. UTC | #1
在 2022/12/16 7:28, Palmer Dabbelt 写道:
> From: Palmer Dabbelt <palmer@rivosinc.com>
> 

In 
https://patchwork.kernel.org/project/linux-rdma/patch/1669905568-62-2-git-send-email-yangx.jy@fujitsu.com/

In this link, it seems that a similar commit for this problem.
Please check it.

Thanks
Zhu Yanjun

> These variables are not used on 32-bit targets as there's a big ifdef
> around their use.  This results on a handful of warnings for 32-bit
> RISC-V allyesconfig:
> 
>    CC      drivers/infiniband/sw/rxe/rxe_resp.o
> linux/drivers/infiniband/sw/rxe/rxe_resp.c: In function 'atomic_write_reply':
> linux/drivers/infiniband/sw/rxe/rxe_resp.c:794:13: error: unused variable 'payload' [-Werror=unused-variable]
>    794 |         int payload = payload_size(pkt);
>        |             ^~~~~~~
> linux/drivers/infiniband/sw/rxe/rxe_resp.c:793:24: error: unused variable 'mr' [-Werror=unused-variable]
>    793 |         struct rxe_mr *mr = qp->resp.mr;
>        |                        ^~
> linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:19: error: unused variable 'dst' [-Werror=unused-variable]
>    791 |         u64 src, *dst;
>        |                   ^~~
> linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:13: error: unused variable 'src' [-Werror=unused-variable]
>    791 |         u64 src, *dst;
>        |             ^~~
> cc1: all warnings being treated as errors
> 
> Fixes: 034e285f8b99 ("RDMA/rxe: Make responder support atomic write on RC service")
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> ---
>   drivers/infiniband/sw/rxe/rxe_resp.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
> index 7a60c7709da0..18977d5a3316 100644
> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
> @@ -788,10 +788,10 @@ static enum resp_states atomic_reply(struct rxe_qp *qp,
>   static enum resp_states atomic_write_reply(struct rxe_qp *qp,
>   						struct rxe_pkt_info *pkt)
>   {
> -	u64 src, *dst;
> -	struct resp_res *res = qp->resp.res;
> -	struct rxe_mr *mr = qp->resp.mr;
> -	int payload = payload_size(pkt);
> +	__maybe_unused u64 src, *dst;
> +	__maybe_unused struct resp_res *res = qp->resp.res;
> +	__maybe_unused struct rxe_mr *mr = qp->resp.mr;
> +	__maybe_unused int payload = payload_size(pkt);
>   
>   	if (!res) {
>   		res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_WRITE_MASK);
Palmer Dabbelt Dec. 16, 2022, 4:03 p.m. UTC | #2
On Thu, 15 Dec 2022 19:11:39 PST (-0800), yanjun.zhu@linux.dev wrote:
> 在 2022/12/16 7:28, Palmer Dabbelt 写道:
>> From: Palmer Dabbelt <palmer@rivosinc.com>
>>
>
> In
> https://patchwork.kernel.org/project/linux-rdma/patch/1669905568-62-2-git-send-email-yangx.jy@fujitsu.com/
>
> In this link, it seems that a similar commit for this problem.
> Please check it.

That one also fixes the compile issues for me.

>
> Thanks
> Zhu Yanjun
>
>> These variables are not used on 32-bit targets as there's a big ifdef
>> around their use.  This results on a handful of warnings for 32-bit
>> RISC-V allyesconfig:
>>
>>    CC      drivers/infiniband/sw/rxe/rxe_resp.o
>> linux/drivers/infiniband/sw/rxe/rxe_resp.c: In function 'atomic_write_reply':
>> linux/drivers/infiniband/sw/rxe/rxe_resp.c:794:13: error: unused variable 'payload' [-Werror=unused-variable]
>>    794 |         int payload = payload_size(pkt);
>>        |             ^~~~~~~
>> linux/drivers/infiniband/sw/rxe/rxe_resp.c:793:24: error: unused variable 'mr' [-Werror=unused-variable]
>>    793 |         struct rxe_mr *mr = qp->resp.mr;
>>        |                        ^~
>> linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:19: error: unused variable 'dst' [-Werror=unused-variable]
>>    791 |         u64 src, *dst;
>>        |                   ^~~
>> linux/drivers/infiniband/sw/rxe/rxe_resp.c:791:13: error: unused variable 'src' [-Werror=unused-variable]
>>    791 |         u64 src, *dst;
>>        |             ^~~
>> cc1: all warnings being treated as errors
>>
>> Fixes: 034e285f8b99 ("RDMA/rxe: Make responder support atomic write on RC service")
>> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
>> ---
>>   drivers/infiniband/sw/rxe/rxe_resp.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
>> index 7a60c7709da0..18977d5a3316 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
>> @@ -788,10 +788,10 @@ static enum resp_states atomic_reply(struct rxe_qp *qp,
>>   static enum resp_states atomic_write_reply(struct rxe_qp *qp,
>>   						struct rxe_pkt_info *pkt)
>>   {
>> -	u64 src, *dst;
>> -	struct resp_res *res = qp->resp.res;
>> -	struct rxe_mr *mr = qp->resp.mr;
>> -	int payload = payload_size(pkt);
>> +	__maybe_unused u64 src, *dst;
>> +	__maybe_unused struct resp_res *res = qp->resp.res;
>> +	__maybe_unused struct rxe_mr *mr = qp->resp.mr;
>> +	__maybe_unused int payload = payload_size(pkt);
>>
>>   	if (!res) {
>>   		res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_WRITE_MASK);
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 7a60c7709da0..18977d5a3316 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -788,10 +788,10 @@  static enum resp_states atomic_reply(struct rxe_qp *qp,
 static enum resp_states atomic_write_reply(struct rxe_qp *qp,
 						struct rxe_pkt_info *pkt)
 {
-	u64 src, *dst;
-	struct resp_res *res = qp->resp.res;
-	struct rxe_mr *mr = qp->resp.mr;
-	int payload = payload_size(pkt);
+	__maybe_unused u64 src, *dst;
+	__maybe_unused struct resp_res *res = qp->resp.res;
+	__maybe_unused struct rxe_mr *mr = qp->resp.mr;
+	__maybe_unused int payload = payload_size(pkt);
 
 	if (!res) {
 		res = rxe_prepare_res(qp, pkt, RXE_ATOMIC_WRITE_MASK);