Skip to contentSkip to conversation

EDAC, sb_edac: mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 3 participants 6 messages Oct 13, 2017 – Oct 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EDAC, sb_edac: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

---
This code was tested by compilation only (GCC 7.2.0 was used). Please, verify if the actual intention of the code is to fall through.

 drivers/edac/sb_edac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/edac/sb_edac.c +1 -0
index 72b98a0..b50d714 100644
@@ -2485,6 +2485,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TA:
 			pvt->pci_ta = pdev;
+			/* fall through */
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_RAS:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_RAS:
 			pvt->pci_ras = pdev;
#1 lore raw

Hi Silva,

The actual intention of the code is NOT to fall through, though current code can work correctly. Thanks for this finding. If you don't mind, I'll submit a fix patch for it with the tag 'Reported-by:' by you.

Thanks!
- Qiuxu

Quoted 25 lines

From: [email protected] [mailto:linux-edac- [email protected]] On Behalf Of Gustavo A. R. Silva
Sent: Saturday, October 14, 2017 4:28 AM
To: Mauro Carvalho Chehab <[email protected]>; Borislav Petkov <[email protected]>
Cc: [email protected]; [email protected]; Gustavo A. R. Silva <[email protected]>
Subject: [PATCH] EDAC, sb_edac: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

---
This code was tested by compilation only (GCC 7.2.0 was used). Please, verify if the actual intention of the code is to fall through.

 drivers/edac/sb_edac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/edac/sb_edac.c index renamed from drivers/edac/sb_edac.c +0 -0

72b98a0..b50d714 100644

drivers/edac/sb_edac.c static int ibridge_mci_bind_devs(struct mem_ctl_info · line 2491

Quoted 7 lines
drivers/edac/sb_edac.c +1 -0
@@ -2485,6 +2485,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info
 *mci,
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TA:
 			pvt->pci_ta = pdev;
+			/* fall through */
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_RAS:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_RAS:

---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#2 lore raw
Quoted 4 lines · Qiuxu

Hi Silva,

The actual intention of the code is NOT to fall through, though current code can work correctly. Thanks for this finding. If you don't mind, I'll submit a fix patch for it with the tag 'Reported-by:' by you.

I'd prefer if Gustavo would submit a patch fixing that, as he caught it and I'd prefer if you don't top-post on public mailing lists please.

Thanks.

#3 lore raw

Quoting Borislav Petkov <[email protected]>:

Quoted 11 lines · Qiuxu
Quoted 6 lines

Hi Silva,

The actual intention of the code is NOT to fall through, though
current code can work correctly.
Thanks for this finding. If you don't mind, I'll submit a fix
patch for it with the tag 'Reported-by:' by you.

I'd prefer if Gustavo would submit a patch fixing that, as he caught it and I'd prefer if you don't top-post on public mailing lists please.

I can do that. I will send a patch shortly.

Thanks
---
Gustavo A. R. Silva

--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 1/1 EDAC, sb_edac: fix missing break in switch

Add missing break statement in order to prevent the code from falling through.

---
 drivers/edac/sb_edac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/edac/sb_edac.c +1 -0
index 72b98a0..f34430f 100644
@@ -2485,6 +2485,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TA:
 			pvt->pci_ta = pdev;
+			break;
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_RAS:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_RAS:
 			pvt->pci_ras = pdev;
maintainer Applied
#5 lore raw

Re: [PATCH] EDAC, sb_edac: fix missing break in switch

Quoted 14 lines · Gustavo A. R. Silva

Add missing break statement in order to prevent the code from falling through.

---
 drivers/edac/sb_edac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/edac/sb_edac.c +0 -0
index 72b98a0..f34430f 100644

drivers/edac/sb_edac.c static int ibridge_mci_bind_devs(struct mem_ctl_info *mci, · line 2491

Quoted 7 lines
drivers/edac/sb_edac.c +1 -0
@@ -2485,6 +2485,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TA:
 			pvt->pci_ta = pdev;
+			break;
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_RAS:
 		case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_RAS:
 			pvt->pci_ras = pdev;

Applied, thanks.