Skip to contentSkip to conversation

RDMA/irdma: Move variable into switch case

PATCH In review Jack Vogel 3 participants 5 messages Feb 1, 2023 – Feb 3, 2023

Subsystems (2)
lore
Share & tools
lore

Jack Vogel

author
#0 lore raw

PATCH 1/1 RDMA/irdma: Move variable into switch case

Fix build warnings when CONFIG_INIT_STACK_ALL_ZERO is enabled.

---
 drivers/infiniband/hw/irdma/hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/hw.c +2 -2
index ab246447520b..e3c639a0d920 100644
@@ -272,8 +272,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 		}
 
 		switch (info->ae_id) {
+		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED: {
 			struct irdma_cm_node *cm_node;
-		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED:
 			cm_node = iwqp->cm_node;
 			if (cm_node->accept_pend) {
 				atomic_dec(&cm_node->listener->pend_accepts_cnt);
@@ -281,7 +281,7 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 			}
 			iwqp->rts_ae_rcvd = 1;
 			wake_up_interruptible(&iwqp->waitq);
-			break;
+		} break;
 		case IRDMA_AE_LLP_FIN_RECEIVED:
 		case IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE:
 			if (qp->term_flags)
Signature · 1 line
2.39.1
#1 lore raw
Quoted 1 line · Jack Vogel

Fix build warnings when CONFIG_INIT_STACK_ALL_ZERO is enabled.

Which warnings do you see? What is you compiler version?

The code is perfectly fine.

Quoted 32 lines
---
 drivers/infiniband/hw/irdma/hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/hw.c +2 -2
index ab246447520b..e3c639a0d920 100644
@@ -272,8 +272,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 		}
 
 		switch (info->ae_id) {
+		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED: {
 			struct irdma_cm_node *cm_node;
-		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED:
 			cm_node = iwqp->cm_node;
 			if (cm_node->accept_pend) {
 				atomic_dec(&cm_node->listener->pend_accepts_cnt);
@@ -281,7 +281,7 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 			}
 			iwqp->rts_ae_rcvd = 1;
 			wake_up_interruptible(&iwqp->waitq);
-			break;
+		} break;
 		case IRDMA_AE_LLP_FIN_RECEIVED:
 		case IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE:
 			if (qp->term_flags)
Signature · 1 line
2.39.1
author
#2 lore raw

Hey Leon,

Oracle switched to GCC11 in our UEK7/OL9 releases recently, leading up to that release we added the ALL_ZERO config option, and then ran into some warnings, our build treats warnings as errors and would fail. For instance this thread:

https://lkml.iu.edu/hypermail/linux/kernel/2202.1/05558.html

A number of changes were made in the mainline code by Kees Cook and even made it into the linux-5.15.y branch, but a couple of them we have carried as specials for the past year, I was recently prodded about the matter again by an internal group, so I thought I would submit these patches upstream.

I must apologize though, for unbeknownst to me, our tools team actually back ported the fix from gcc12 regarding these warnings and forgot to tell the UEK group about it :) It wasn’t until you asked about the warnings, I reverted the commits and did a build to capture them, then I discovered they no longer occur. So, sorry about the noise. I will be reverting our own changes as unnecessary now.

Regards,

Jack

Quoted 41 lines · Leon Romanovsky
Quoted 1 line · Jack Vogel

Fix build warnings when CONFIG_INIT_STACK_ALL_ZERO is enabled.

Which warnings do you see? What is you compiler version?

The code is perfectly fine.

Quoted 32 lines

---
drivers/infiniband/hw/irdma/hw.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/hw.c +2 -2
index ab246447520b..e3c639a0d920 100644
@@ -272,8 +272,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 		}
 
 		switch (info->ae_id) {
+		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED: {
 			struct irdma_cm_node *cm_node;
-		case IRDMA_AE_LLP_CONNECTION_ESTABLISHED:
 			cm_node = iwqp->cm_node;
 			if (cm_node->accept_pend) {
 				atomic_dec(&cm_node->listener->pend_accepts_cnt);
@@ -281,7 +281,7 @@ static void irdma_process_aeq(struct irdma_pci_f *rf)
 			}
 			iwqp->rts_ae_rcvd = 1;
 			wake_up_interruptible(&iwqp->waitq);
-			break;
+		} break;
 		case IRDMA_AE_LLP_FIN_RECEIVED:
 		case IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE:
 			if (qp->term_flags)
Signature · 1 line
2.39.1
#3 lore raw
Quoted 9 lines · Jack Vogel

Hey Leon,

Oracle switched to GCC11 in our UEK7/OL9 releases recently, leading up to that release we added the ALL_ZERO config option, and then ran into some warnings, our build treats warnings as errors and would fail. For instance this thread:

https://lkml.iu.edu/hypermail/linux/kernel/2202.1/05558.html

A number of changes were made in the mainline code by Kees Cook and even made it into the linux-5.15.y branch, but a couple of them we have carried as specials for the past year, I was recently prodded about the matter again by an internal group, so I thought I would submit these patches upstream.

I must apologize though, for unbeknownst to me, our tools team actually back ported the fix from gcc12 regarding these warnings and forgot to tell the UEK group about it :) It wasn’t until you asked about the warnings, I reverted the commits and did a build to capture them, then I discovered they no longer occur. So, sorry about the noise. I will be reverting our own changes as unnecessary now.

Glad to hear.

Thanks

#4 lore raw
Quoted 5 lines · Leon Romanovsky
Quoted 4 lines · Jack Vogel

Hey Leon,

Oracle switched to GCC11 in our UEK7/OL9 releases recently, leading up to that release we added the ALL_ZERO config option, and then ran into some warnings, our build treats warnings as errors and would fail. For instance this thread:

Quoted 7 lines
Quoted 5 lines

https://lkml.iu.edu/hypermail/linux/kernel/2202.1/05558.html

A number of changes were made in the mainline code by Kees Cook and even made it into the linux-5.15.y branch, but a couple of them we have carried as specials for the past year, I was recently prodded about the matter again by an internal group, so I thought I would submit these patches upstream.

I must apologize though, for unbeknownst to me, our tools team actually back ported the fix from gcc12 regarding these warnings and forgot to tell the UEK group about it :) It wasn’t until you asked about the warnings, I reverted the commits and did a build to capture them, then I discovered they no longer occur. So, sorry about the noise. I will be reverting our own changes as unnecessary now.

Glad to hear.

Regardless, it is really weird coding style to have a variable block immediately after the switch statement

Jason