Skip to contentSkip to conversation

PCI: Mark expected switch fall-throughs

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Jul 5, 2018 – Jul 10, 2018 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Mark expected switch fall-throughs

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

Warning level 2 was used: -Wimplicit-fallthrough=2

---
 drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
 drivers/pci/hotplug/shpchp_ctrl.c | 2 ++
 drivers/pci/pci.c                 | 1 +
 drivers/pci/quirks.c              | 1 +
 4 files changed, 6 insertions(+)
drivers/pci/hotplug/pciehp_ctrl.c +2 -0
index c684faa..cfc46e8 100644
@@ -436,6 +436,7 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGON_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWERON_STATE;
 		mutex_unlock(&p_slot->lock);
@@ -473,6 +474,7 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWEROFF_STATE;
 		mutex_unlock(&p_slot->lock);
drivers/pci/hotplug/shpchp_ctrl.c +2 -0
index 1047b56..1267dcc 100644
@@ -654,6 +654,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGON_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWERON_STATE;
 		mutex_unlock(&p_slot->lock);
@@ -689,6 +690,7 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWEROFF_STATE;
 		mutex_unlock(&p_slot->lock);
drivers/pci/pci.c +1 -0
index 97acba7..f5c6ab1 100644
@@ -2045,6 +2045,7 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup)
 		case PCI_D2:
 			if (pci_no_d1d2(dev))
 				break;
+			/* else: fall through */
 		default:
 			target_state = state;
 		}
drivers/pci/quirks.c +1 -0
index f439de8..502275c 100644
@@ -2105,6 +2105,7 @@ static void quirk_netmos(struct pci_dev *dev)
 		if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
 				dev->subsystem_device == 0x0299)
 			return;
+		/* else: fall through */
 	case PCI_DEVICE_ID_NETMOS_9735:
 	case PCI_DEVICE_ID_NETMOS_9745:
 	case PCI_DEVICE_ID_NETMOS_9845:
Signature · 1 line
2.7.4
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

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

Warning level 2 was used: -Wimplicit-fallthrough=2

Applied to pci/misc for v4.19, thanks!

If you'd like to apply this elsewhere as part of a larger series, feel free to do that. Just add my ack and let me know to drop it.

Quoted 74 lines
---
 drivers/pci/hotplug/pciehp_ctrl.c | 2 ++
 drivers/pci/hotplug/shpchp_ctrl.c | 2 ++
 drivers/pci/pci.c                 | 1 +
 drivers/pci/quirks.c              | 1 +
 4 files changed, 6 insertions(+)
drivers/pci/hotplug/pciehp_ctrl.c +2 -0
index c684faa..cfc46e8 100644
@@ -436,6 +436,7 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGON_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWERON_STATE;
 		mutex_unlock(&p_slot->lock);
@@ -473,6 +474,7 @@ int pciehp_sysfs_disable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWEROFF_STATE;
 		mutex_unlock(&p_slot->lock);
drivers/pci/hotplug/shpchp_ctrl.c +2 -0
index 1047b56..1267dcc 100644
@@ -654,6 +654,7 @@ int shpchp_sysfs_enable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGON_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWERON_STATE;
 		mutex_unlock(&p_slot->lock);
@@ -689,6 +690,7 @@ int shpchp_sysfs_disable_slot(struct slot *p_slot)
 	switch (p_slot->state) {
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&p_slot->work);
+		/* fall through */
 	case STATIC_STATE:
 		p_slot->state = POWEROFF_STATE;
 		mutex_unlock(&p_slot->lock);
drivers/pci/pci.c +1 -0
index 97acba7..f5c6ab1 100644
@@ -2045,6 +2045,7 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup)
 		case PCI_D2:
 			if (pci_no_d1d2(dev))
 				break;
+			/* else: fall through */
 		default:
 			target_state = state;
 		}
drivers/pci/quirks.c +1 -0
index f439de8..502275c 100644
@@ -2105,6 +2105,7 @@ static void quirk_netmos(struct pci_dev *dev)
 		if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
 				dev->subsystem_device == 0x0299)
 			return;
+		/* else: fall through */
 	case PCI_DEVICE_ID_NETMOS_9735:
 	case PCI_DEVICE_ID_NETMOS_9745:
 	case PCI_DEVICE_ID_NETMOS_9845:
Signature · 1 line
2.7.4