diff mbox series

[1/2] PCI: pciehp: Avoid implicit fallthroughs in switch statements

Message ID 92c3c456edb461494d5c44e1ff6bab2711228ff1.1532754355.git.lukas@wunner.de (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series [1/2] PCI: pciehp: Avoid implicit fallthroughs in switch statements | expand

Commit Message

Lukas Wunner July 28, 2018, 5:22 a.m. UTC
Per Mika's request, add an explicit break to the last case of switch
statements everywhere in pciehp to be more defensive towards future
amendments.

Per Gustavo's request, mark all non-empty implicit fallthroughs with a
comment to silence warnings triggered by -Wimplicit-fallthrough=2.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/pci/hotplug/pciehp_ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mika Westerberg July 31, 2018, 7:59 a.m. UTC | #1
On Sat, Jul 28, 2018 at 07:22:00AM +0200, Lukas Wunner wrote:
> Per Mika's request, add an explicit break to the last case of switch
> statements everywhere in pciehp to be more defensive towards future
> amendments.
> 
> Per Gustavo's request, mark all non-empty implicit fallthroughs with a
> comment to silence warnings triggered by -Wimplicit-fallthrough=2.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Gustavo A. R. Silva July 31, 2018, 3:13 p.m. UTC | #2
On 07/28/2018 12:22 AM, Lukas Wunner wrote:
> Per Mika's request, add an explicit break to the last case of switch
> statements everywhere in pciehp to be more defensive towards future
> amendments.
> 
> Per Gustavo's request, mark all non-empty implicit fallthroughs with a
> comment to silence warnings triggered by -Wimplicit-fallthrough=2.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---


Acked-by: Gustavo A. R. Silva <gustavo@embeddedor.com>


Thanks
--
Gustavo
Bjorn Helgaas July 31, 2018, 6:29 p.m. UTC | #3
On Sat, Jul 28, 2018 at 07:22:00AM +0200, Lukas Wunner wrote:
> Per Mika's request, add an explicit break to the last case of switch
> statements everywhere in pciehp to be more defensive towards future
> amendments.
> 
> Per Gustavo's request, mark all non-empty implicit fallthroughs with a
> comment to silence warnings triggered by -Wimplicit-fallthrough=2.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Both applied, with Mika's reviewed-by on both and Gustavo's ack on the
first, to pci/hotplug for v4.19, thanks!

> ---
>  drivers/pci/hotplug/pciehp_ctrl.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
> index 6855933ab372..da7c72372ffc 100644
> --- a/drivers/pci/hotplug/pciehp_ctrl.c
> +++ b/drivers/pci/hotplug/pciehp_ctrl.c
> @@ -211,6 +211,7 @@ void pciehp_handle_disable_request(struct slot *slot)
>  	case BLINKINGON_STATE:
>  	case BLINKINGOFF_STATE:
>  		cancel_delayed_work(&slot->work);
> +		break;
>  	}
>  	slot->state = POWEROFF_STATE;
>  	mutex_unlock(&slot->lock);
> @@ -232,6 +233,7 @@ void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
>  	switch (slot->state) {
>  	case BLINKINGOFF_STATE:
>  		cancel_delayed_work(&slot->work);
> +		/* fall through */
>  	case ON_STATE:
>  		slot->state = POWEROFF_STATE;
>  		mutex_unlock(&slot->lock);
> @@ -245,6 +247,7 @@ void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
>  		break;
>  	default:
>  		mutex_unlock(&slot->lock);
> +		break;
>  	}
>  
>  	/* Turn the slot on if it's occupied or link is up */
> @@ -259,6 +262,7 @@ void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
>  	switch (slot->state) {
>  	case BLINKINGON_STATE:
>  		cancel_delayed_work(&slot->work);
> +		/* fall through */
>  	case OFF_STATE:
>  		slot->state = POWERON_STATE;
>  		mutex_unlock(&slot->lock);
> @@ -272,6 +276,7 @@ void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
>  		break;
>  	default:
>  		mutex_unlock(&slot->lock);
> +		break;
>  	}
>  }
>  
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 6855933ab372..da7c72372ffc 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -211,6 +211,7 @@  void pciehp_handle_disable_request(struct slot *slot)
 	case BLINKINGON_STATE:
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&slot->work);
+		break;
 	}
 	slot->state = POWEROFF_STATE;
 	mutex_unlock(&slot->lock);
@@ -232,6 +233,7 @@  void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
 	switch (slot->state) {
 	case BLINKINGOFF_STATE:
 		cancel_delayed_work(&slot->work);
+		/* fall through */
 	case ON_STATE:
 		slot->state = POWEROFF_STATE;
 		mutex_unlock(&slot->lock);
@@ -245,6 +247,7 @@  void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
 		break;
 	default:
 		mutex_unlock(&slot->lock);
+		break;
 	}
 
 	/* Turn the slot on if it's occupied or link is up */
@@ -259,6 +262,7 @@  void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
 	switch (slot->state) {
 	case BLINKINGON_STATE:
 		cancel_delayed_work(&slot->work);
+		/* fall through */
 	case OFF_STATE:
 		slot->state = POWERON_STATE;
 		mutex_unlock(&slot->lock);
@@ -272,6 +276,7 @@  void pciehp_handle_presence_or_link_change(struct slot *slot, u32 events)
 		break;
 	default:
 		mutex_unlock(&slot->lock);
+		break;
 	}
 }