diff mbox series

[rdma-next] RDMA/bnxt_re: Initialize opcode while sending message

Message ID 6ad1e44be2b560986da6fdc6b68da606413e9026.1686644105.git.leonro@nvidia.com (mailing list archive)
State Accepted
Headers show
Series [rdma-next] RDMA/bnxt_re: Initialize opcode while sending message | expand

Commit Message

Leon Romanovsky June 13, 2023, 8:15 a.m. UTC
From: Leon Romanovsky <leonro@nvidia.com>

Fix compilation warning:

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:325:18:
  error: variable 'opcode' is uninitialized when used here [-Werror,-Wuninitialized]
        crsqe->opcode = opcode;
                        ^~~~~~
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:291:11:
  note: initialize the variable 'opcode' to silence this warning
        u8 opcode;
                 ^
                  = '\0'

Fixes: bcfee4ce3e01 ("RDMA/bnxt_re: remove redundant cmdq_bitmap")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Selvin Xavier June 13, 2023, 8:59 a.m. UTC | #1
On Tue, Jun 13, 2023 at 1:46 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> From: Leon Romanovsky <leonro@nvidia.com>
>
> Fix compilation warning:
>
> drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:325:18:
>   error: variable 'opcode' is uninitialized when used here [-Werror,-Wuninitialized]
>         crsqe->opcode = opcode;
>                         ^~~~~~
> drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:291:11:
>   note: initialize the variable 'opcode' to silence this warning
>         u8 opcode;
>                  ^
>                   = '\0'
>
> Fixes: bcfee4ce3e01 ("RDMA/bnxt_re: remove redundant cmdq_bitmap")
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>

Thanks

> ---
>  drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
> index bb5aebafe162..92b3a4fbd0b2 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
> @@ -274,7 +274,7 @@ static void __send_message_no_waiter(struct bnxt_qplib_rcfw *rcfw,
>  }
>
>  static int __send_message(struct bnxt_qplib_rcfw *rcfw,
> -                         struct bnxt_qplib_cmdqmsg *msg)
> +                         struct bnxt_qplib_cmdqmsg *msg, u8 opcode)
>  {
>         u32 bsize, free_slots, required_slots;
>         struct bnxt_qplib_cmdq_ctx *cmdq;
> @@ -285,7 +285,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
>         struct pci_dev *pdev;
>         unsigned long flags;
>         u16 cookie;
> -       u8 opcode;
>         u8 *preq;
>
>         cmdq = &rcfw->cmdq;
> @@ -490,7 +489,7 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
>         if (rc)
>                 return rc == -ENXIO ? bnxt_qplib_map_rc(opcode) : rc;
>
> -       rc = __send_message(rcfw, msg);
> +       rc = __send_message(rcfw, msg, opcode);
>         if (rc)
>                 return rc;
>
> --
> 2.40.1
>
Leon Romanovsky June 13, 2023, 9:10 a.m. UTC | #2
On Tue, 13 Jun 2023 11:15:57 +0300, Leon Romanovsky wrote:
> Fix compilation warning:
> 
> drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:325:18:
>   error: variable 'opcode' is uninitialized when used here [-Werror,-Wuninitialized]
>         crsqe->opcode = opcode;
>                         ^~~~~~
> drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:291:11:
>   note: initialize the variable 'opcode' to silence this warning
>         u8 opcode;
>                  ^
>                   = '\0'
> 
> [...]

Applied, thanks!

[1/1] RDMA/bnxt_re: Initialize opcode while sending message
      https://git.kernel.org/rdma/rdma/c/56a1f96d30dc9b

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
index bb5aebafe162..92b3a4fbd0b2 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
@@ -274,7 +274,7 @@  static void __send_message_no_waiter(struct bnxt_qplib_rcfw *rcfw,
 }
 
 static int __send_message(struct bnxt_qplib_rcfw *rcfw,
-			  struct bnxt_qplib_cmdqmsg *msg)
+			  struct bnxt_qplib_cmdqmsg *msg, u8 opcode)
 {
 	u32 bsize, free_slots, required_slots;
 	struct bnxt_qplib_cmdq_ctx *cmdq;
@@ -285,7 +285,6 @@  static int __send_message(struct bnxt_qplib_rcfw *rcfw,
 	struct pci_dev *pdev;
 	unsigned long flags;
 	u16 cookie;
-	u8 opcode;
 	u8 *preq;
 
 	cmdq = &rcfw->cmdq;
@@ -490,7 +489,7 @@  static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
 	if (rc)
 		return rc == -ENXIO ? bnxt_qplib_map_rc(opcode) : rc;
 
-	rc = __send_message(rcfw, msg);
+	rc = __send_message(rcfw, msg, opcode);
 	if (rc)
 		return rc;