All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Sinan Kaya <okaya@kernel.org>,
	linux-pci@vger.kernel.org
Subject: [PATCH 1/2] PCI: pciehp: Avoid implicit fallthroughs in switch statements
Date: Sat, 28 Jul 2018 07:22:00 +0200	[thread overview]
Message-ID: <92c3c456edb461494d5c44e1ff6bab2711228ff1.1532754355.git.lukas@wunner.de> (raw)

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(+)

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

             reply	other threads:[~2018-07-28  5:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-28  5:22 Lukas Wunner [this message]
2018-07-28  5:22 ` [PATCH 2/2] PCI: pciehp: Deduplicate presence check on probe & resume Lukas Wunner
2018-07-31  8:03   ` Mika Westerberg
2018-07-31 21:22     ` Lukas Wunner
2018-07-31  7:59 ` [PATCH 1/2] PCI: pciehp: Avoid implicit fallthroughs in switch statements Mika Westerberg
2018-07-31 15:13 ` Gustavo A. R. Silva
2018-07-31 18:29 ` Bjorn Helgaas

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=92c3c456edb461494d5c44e1ff6bab2711228ff1.1532754355.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=gustavo@embeddedor.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=okaya@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.