Skip to contentSkip to conversation

nvme-pci: mark expected switch fall-through

PATCH Applied Gustavo A. R. Silva 4 participants 5 messages May 7, 2019 – May 8, 2019 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-pci: mark expected switch fall-through

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

This patch fixes the following warning:

drivers/nvme/host/pci.c: In function ?nvme_timeout?:
drivers/nvme/host/pci.c:1298:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
shutdown = true;
~~~~~~~~~^~~~~~
drivers/nvme/host/pci.c:1299:2: note: here
case NVME_CTRL_CONNECTING:
^~~~

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

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Signed-off-by Gustavo A. R. Silva <gustavo at embeddedor.com>
---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
index 3e4fb891a95a..a12f992868c9 100644
@@ -1296,6 +1296,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	switch (dev->ctrl.state) {
 	case NVME_CTRL_DELETING:
 		shutdown = true;
+		/* fall through */
 	case NVME_CTRL_CONNECTING:
 	case NVME_CTRL_RESETTING:
 		dev_warn_ratelimited(dev->ctrl.device,
Signature · 1 line
2.21.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

drivers/nvme/host/pci.c static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · line 1302

Quoted 8 lines · Gustavo A. R. Silva
drivers/nvme/host/pci.c +1 -0
@@ -1296,6 +1296,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	switch (dev->ctrl.state) {
 	case NVME_CTRL_DELETING:
 		shutdown = true;
+		/* fall through */
 	case NVME_CTRL_CONNECTING:
 	case NVME_CTRL_RESETTING:
 		dev_warn_ratelimited(dev->ctrl.device,

Thanks, Looks good.

Reviewed-by Keith Busch <keith.busch at intel.com>
Reviewed-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva

Looks good.

Reviewed-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Quoted 35 lines · Gustavo A. R. Silva

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

This patch fixes the following warning:

drivers/nvme/host/pci.c: In function ?nvme_timeout?:
drivers/nvme/host/pci.c:1298:12: warning: this statement may fall through [-Wimplicit-fallthrough=]

   shutdown = true;
   ~~~~~~~~~^~~~~~

drivers/nvme/host/pci.c:1299:2: note: here
case NVME_CTRL_CONNECTING:
^~~~

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

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Signed-off-by Gustavo A. R. Silva <gustavo at embeddedor.com>
---
 drivers/nvme/host/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
index 3e4fb891a95a..a12f992868c9 100644
@@ -1296,6 +1296,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	switch (dev->ctrl.state) {
 	case NVME_CTRL_DELETING:
 		shutdown = true;
+		/* fall through */
 	case NVME_CTRL_CONNECTING:
 	case NVME_CTRL_RESETTING:
 		dev_warn_ratelimited(dev->ctrl.device,
#4 lore raw
Quoted 4 lines · Christoph Hellwig

Thanks,

applied to nvme-5.2.

Great. :)

Thanks, Christoph.
--
Gustavo