Skip to contentSkip to conversation

Fix fallthrough warnings.

PATCH In review Michal Suchanek 2 participants 7 messages Aug 29, 2019

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

cover Fix fallthrough warnings.

Build with recent compiler results in numerous fallthrough warnings.

The code looks correct to me so just adding the comments to quiet gcc.

Please review if the fallthrough was really intentional.

Thanks

Michal

Michal Suchanek (3):
scsi: cxlflash: Fix fallthrough warnings.
scsi: ibmvfc: Fix fallthrough warnings.
scsi: ibmvscsi: tgt: Fix fallthrough warnings.

 drivers/scsi/cxlflash/main.c             | 8 ++++++++
 drivers/scsi/ibmvscsi/ibmvfc.c           | 3 +++
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +++
 3 files changed, 14 insertions(+)
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/3 scsi: cxlflash: Fix fallthrough warnings.

Add fallthrough comments where missing.

---
 drivers/scsi/cxlflash/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/scsi/cxlflash/main.c +8 -0
index b1f4724efde2..f402fa9a7bec 100644
@@ -753,10 +753,13 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,
 		/* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */
 		if (index == PRIMARY_HWQ)
 			cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
+		/* fall through */
 	case UNMAP_TWO:
 		cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
+		/* fall through */
 	case UNMAP_ONE:
 		cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
+		/* fall through */
 	case FREE_IRQ:
 		cfg->ops->free_afu_irqs(hwq->ctx_cookie);
 		/* fall through */
@@ -973,14 +976,18 @@ static void cxlflash_remove(struct pci_dev *pdev)
 	switch (cfg->init_state) {
 	case INIT_STATE_CDEV:
 		cxlflash_release_chrdev(cfg);
+		/* fall through */
 	case INIT_STATE_SCSI:
 		cxlflash_term_local_luns(cfg);
 		scsi_remove_host(cfg->host);
+		/* fall through */
 	case INIT_STATE_AFU:
 		term_afu(cfg);
+		/* fall through */
 	case INIT_STATE_PCI:
 		cfg->ops->destroy_afu(cfg->afu_cookie);
 		pci_disable_device(pdev);
+		/* fall through */
 	case INIT_STATE_NONE:
 		free_mem(cfg);
 		scsi_host_put(cfg->host);
@@ -3017,6 +3024,7 @@ static ssize_t num_hwqs_store(struct device *dev,
 		wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
 		if (cfg->state == STATE_NORMAL)
 			goto retry;
+		/* fall through */
 	default:
 		/* Ideally should not happen */
 		dev_err(dev, "%s: Device is not ready, state=%d\n",
Signature · 1 line
2.12.3
#2 lore raw

Re: [PATCH 1/3] scsi: cxlflash: Fix fallthrough warnings.

Below commit queued up for 5.4 includes these changes.

commit 657bd277c162580674ddb86a90c4aeb62639bff5

Author: Gustavo A. R. Silva <[email protected]>
Date:   Sun Jul 28 19:21:19 2019 -0500

Thanks,
Uma Krishnan

Quoted 57 lines · Michal Suchanek

Add fallthrough comments where missing.

---
drivers/scsi/cxlflash/main.c | 8 ++++++++

1 file changed, 8 insertions(+)
drivers/scsi/cxlflash/main.c +8 -0
index b1f4724efde2..f402fa9a7bec 100644
@@ -753,10 +753,13 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,
 		/* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */
 		if (index == PRIMARY_HWQ)
 			cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
+		/* fall through */
 	case UNMAP_TWO:
 		cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
+		/* fall through */
 	case UNMAP_ONE:
 		cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
+		/* fall through */
 	case FREE_IRQ:
 		cfg->ops->free_afu_irqs(hwq->ctx_cookie);
 		/* fall through */
@@ -973,14 +976,18 @@ static void cxlflash_remove(struct pci_dev *pdev)
 	switch (cfg->init_state) {
 	case INIT_STATE_CDEV:
 		cxlflash_release_chrdev(cfg);
+		/* fall through */
 	case INIT_STATE_SCSI:
 		cxlflash_term_local_luns(cfg);
 		scsi_remove_host(cfg->host);
+		/* fall through */
 	case INIT_STATE_AFU:
 		term_afu(cfg);
+		/* fall through */
 	case INIT_STATE_PCI:
 		cfg->ops->destroy_afu(cfg->afu_cookie);
 		pci_disable_device(pdev);
+		/* fall through */
 	case INIT_STATE_NONE:
 		free_mem(cfg);
 		scsi_host_put(cfg->host);
@@ -3017,6 +3024,7 @@ static ssize_t num_hwqs_store(struct device *dev,
 		wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
 		if (cfg->state == STATE_NORMAL)
 			goto retry;
+		/* fall through */
 	default:
 		/* Ideally should not happen */
 		dev_err(dev, "%s: Device is not ready, state=%d\n",
Signature · 1 line
2.12.3
#3 lore raw

Re: [PATCH 1/3] scsi: cxlflash: Fix fallthrough warnings.

In reply to Michal Suchanek

Below commit queued up for 5.4 includes these changes.

commit 657bd277c162580674ddb86a90c4aeb62639bff5
Author: Gustavo A. R. Silva <[email protected]>
Date:   Sun Jul 28 19:21:19 2019 -0500

Thanks,
Uma Krishnan

On Aug 29, 2019, at 7:32 AM, Michal Suchanek <[email protected]> wrote:

Add fallthrough comments where missing.

---
drivers/scsi/cxlflash/main.c | 8 ++++++++

1 file changed, 8 insertions(+)
drivers/scsi/cxlflash/main.c +0 -0
index b1f4724efde2..f402fa9a7bec 100644
@@ -753,10 +753,13 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,

/* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */ if (index == PRIMARY_HWQ) cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
+/* fall through */
case UNMAP_TWO:
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
+/* fall through */
case UNMAP_ONE:
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
+/* fall through */
case FREE_IRQ:
cfg->ops->free_afu_irqs(hwq->ctx_cookie);
/* fall through */
@@ -973,14 +976,18 @@ static void cxlflash_remove(struct pci_dev *pdev) switch (cfg->init_state) {
case INIT_STATE_CDEV:
cxlflash_release_chrdev(cfg);
+/* fall through */
case INIT_STATE_SCSI:
cxlflash_term_local_luns(cfg);
scsi_remove_host(cfg->host);
+/* fall through */
case INIT_STATE_AFU:
term_afu(cfg);
+/* fall through */
case INIT_STATE_PCI:
cfg->ops->destroy_afu(cfg->afu_cookie); pci_disable_device(pdev);
+/* fall through */
case INIT_STATE_NONE:
free_mem(cfg);
scsi_host_put(cfg->host);
@@ -3017,6 +3024,7 @@ static ssize_t num_hwqs_store(struct device *dev, wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
if (cfg->state == STATE_NORMAL)
goto retry;
+/* fall through */
default:
/* Ideally should not happen */
dev_err(dev, "%s: Device is not ready, state=%d\n",
--
2.12.3

#4 lore raw

Re: [PATCH 1/3] scsi: cxlflash: Fix fallthrough warnings.

Quoted 8 lines · On Thu, 29 Aug 2019 15:34:08 -0500 Uma Krishnan <[email protected]> wrote:

Below commit queued up for 5.4 includes these changes.

commit 657bd277c162580674ddb86a90c4aeb62639bff5
Author: Gustavo A. R. Silva <[email protected]>
Date:   Sun Jul 28 19:21:19 2019 -0500

Thanks,
Uma Krishnan

Works for me as well.

Thanks

Michal

Quoted 60 lines · Michal Suchanek
Quoted 57 lines

Add fallthrough comments where missing.

---
drivers/scsi/cxlflash/main.c | 8 ++++++++

1 file changed, 8 insertions(+)
drivers/scsi/cxlflash/main.c +1 -0
index b1f4724efde2..f402fa9a7bec 100644
@@ -753,10 +753,13 @@ static void term_intr(struct cxlflash_cfg *cfg, enum undo_level level,
 /* SISL_MSI_ASYNC_ERROR is setup only for the primary HWQ */
 if (index == PRIMARY_HWQ)
 cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 3, hwq);
+ /* fall through */

case UNMAP_TWO:
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
+ /* fall through */
case UNMAP_ONE:
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
+ /* fall through */
case FREE_IRQ:
cfg->ops->free_afu_irqs(hwq->ctx_cookie);
/* fall through */

drivers/scsi/cxlflash/main.c +0 -0
@@ -973,14 +976,18 @@ static void cxlflash_remove(struct pci_dev *pdev)
 switch (cfg->init_state) {

case INIT_STATE_CDEV:
cxlflash_release_chrdev(cfg);
+ /* fall through */
case INIT_STATE_SCSI:
cxlflash_term_local_luns(cfg);
scsi_remove_host(cfg->host);
+ /* fall through */
case INIT_STATE_AFU:
term_afu(cfg);
+ /* fall through */
case INIT_STATE_PCI:
cfg->ops->destroy_afu(cfg->afu_cookie);
pci_disable_device(pdev);
+ /* fall through */
case INIT_STATE_NONE:
free_mem(cfg);
scsi_host_put(cfg->host);

drivers/scsi/cxlflash/main.c +1 -0
@@ -3017,6 +3024,7 @@ static ssize_t num_hwqs_store(struct device *dev,
 wait_event(cfg->reset_waitq, cfg->state != STATE_RESET);
 if (cfg->state == STATE_NORMAL)
 goto retry;
+ /* fall through */

default:
/* Ideally should not happen */ dev_err(dev, "%s: Device is not ready, state=%d\n", --
2.12.3

#5 lore raw

PATCH 2/3 scsi: ibmvfc: Fix fallthrough warnings.

In reply to Michal Suchanek

Add fallthrough comments where they are missing.

---
 drivers/scsi/ibmvscsi/ibmvfc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/ibmvscsi/ibmvfc.c +3 -0
index 8cdbac076a1b..2a06a5b4d3a5 100644
@@ -1830,6 +1830,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
 		port_id = (bsg_request->rqst_data.h_els.port_id[0] << 16) |
 			(bsg_request->rqst_data.h_els.port_id[1] << 8) |
 			bsg_request->rqst_data.h_els.port_id[2];
+		/* fallthrough */
 	case FC_BSG_RPT_ELS:
 		fc_flags = IBMVFC_FC_ELS;
 		break;
@@ -1838,6 +1839,7 @@ static int ibmvfc_bsg_request(struct bsg_job *job)
 		port_id = (bsg_request->rqst_data.h_ct.port_id[0] << 16) |
 			(bsg_request->rqst_data.h_ct.port_id[1] << 8) |
 			bsg_request->rqst_data.h_ct.port_id[2];
+		/* fallthrough */
 	case FC_BSG_RPT_CT:
 		fc_flags = IBMVFC_FC_CT_IU;
 		break;
@@ -4020,6 +4022,7 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt)
 		return;
 	case IBMVFC_MAD_CRQ_ERROR:
 		ibmvfc_retry_host_init(vhost);
+		/* fallthrough */
 	case IBMVFC_MAD_DRIVER_FAILED:
 		ibmvfc_free_event(evt);
 		return;
Signature · 1 line
2.12.3
#6 lore raw

PATCH 3/3 scsi: ibmvscsi: tgt: Fix fallthrough warnings.

In reply to Michal Suchanek

Add fallthrough comments where they are missing.

---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +3 -0
index 7f9535392a93..57475dbcae0f 100644
@@ -1581,6 +1581,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
 	case H_PERMISSION:
 		if (connection_broken(vscsi))
 			flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
+		/* fallthrough */
 	default:
 		dev_err(&vscsi->dev, "adapter_info: h_copy_rdma to client failed, rc %ld\n",
 			rc);
@@ -2492,8 +2493,10 @@ static long ibmvscsis_ping_response(struct scsi_info *vscsi)
 		break;
 	case H_CLOSED:
 		vscsi->flags |= CLIENT_FAILED;
+		/* fallthrough */
 	case H_DROPPED:
 		vscsi->flags |= RESPONSE_Q_DOWN;
+		/* fallthrough */
 	case H_REMOTE_PARM:
 		dev_err(&vscsi->dev, "ping_response: h_send_crq failed, rc %ld\n",
 			rc);
Signature · 1 line
2.12.3