public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Victor Erminpour <victor.erminpour@oracle.com>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>
Cc: "jgg@ziepe.ca" <jgg@ziepe.ca>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"trivial@kernel.org" <trivial@kernel.org>
Subject: RE: [PATCH] RDMA/irdma: Fix GCC 12 warning
Date: Thu, 10 Feb 2022 22:09:18 +0000	[thread overview]
Message-ID: <35240f17968242409a39427c303370df@intel.com> (raw)
In-Reply-To: <1644453235-1437-1-git-send-email-victor.erminpour@oracle.com>

> Subject: [PATCH] RDMA/irdma: Fix GCC 12 warning
> 
> When building with automatic stack variable initialization, GCC 12 complains about
> variables defined outside of switch case statements.
> Move the variable into the case that uses it, which silences the warning:
> 
> ./drivers/infiniband/hw/irdma/hw.c:270:47: error: statement will never be executed [-
> Werror=switch-unreachable]
>   270 |                         struct irdma_cm_node *cm_node;
>       |
> 
> ./drivers/infiniband/hw/irdma/utils.c:1215:50: error: statement will never be executed
> [-Werror=switch-unreachable]
>   1215 |                         struct irdma_gen_ae_info ae_info;
>        |
> 
> Signed-off-by: Victor Erminpour <victor.erminpour@oracle.com>
> ---
>  drivers/infiniband/hw/irdma/hw.c    | 2 +-
>  drivers/infiniband/hw/irdma/utils.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
> index 89234d04cc65..a41a3b128d0d 100644
> --- a/drivers/infiniband/hw/irdma/hw.c
> +++ b/drivers/infiniband/hw/irdma/hw.c
> @@ -267,8 +267,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
>  		}
> 
>  		switch (info->ae_id) {
> -			struct irdma_cm_node *cm_node;
>  		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED:
> +			struct irdma_cm_node *cm_node;
>  			cm_node = iwqp->cm_node;
>  			if (cm_node->accept_pend) {
>  				atomic_dec(&cm_node->listener-

This doesn't compile.

drivers/infiniband/hw/irdma/hw.c: In function \u2018irdma_process_aeq\u2019:
drivers/infiniband/hw/irdma/hw.c:271:4: error: a label can only be part of a statement and a declaration is not a statement
  271 |    struct irdma_cm_node *cm_node;

Seems like we are accommodating for gcc12 bug since this C code is legit? 

Shiraz


  reply	other threads:[~2022-02-10 22:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  0:33 [PATCH] RDMA/irdma: Fix GCC 12 warning Victor Erminpour
2022-02-10 22:09 ` Saleem, Shiraz [this message]
2022-02-10 23:36   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35240f17968242409a39427c303370df@intel.com \
    --to=shiraz.saleem@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    --cc=trivial@kernel.org \
    --cc=victor.erminpour@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox