* [PATCH] scsi: cxlflash: Mark expected switch fall-throughs
@ 2019-07-29 0:21 Gustavo A. R. Silva
2019-07-29 16:47 ` Kees Cook
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-29 0:21 UTC (permalink / raw)
To: Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, Stephen Rothwell,
Kees Cook
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
drivers/scsi/cxlflash/main.c: In function 'send_afu_cmd':
drivers/scsi/cxlflash/main.c:2347:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (rc) {
^
drivers/scsi/cxlflash/main.c:2357:2: note: here
case -EAGAIN:
^~~~
drivers/scsi/cxlflash/main.c: In function 'term_intr':
drivers/scsi/cxlflash/main.c:754:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (index == PRIMARY_HWQ)
^
drivers/scsi/cxlflash/main.c:756:2: note: here
case UNMAP_TWO:
^~~~
drivers/scsi/cxlflash/main.c:757:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:758:2: note: here
case UNMAP_ONE:
^~~~
drivers/scsi/cxlflash/main.c:759:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:760:2: note: here
case FREE_IRQ:
^~~~
drivers/scsi/cxlflash/main.c: In function 'cxlflash_remove':
drivers/scsi/cxlflash/main.c:975:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
cxlflash_release_chrdev(cfg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:976:2: note: here
case INIT_STATE_SCSI:
^~~~
drivers/scsi/cxlflash/main.c:978:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
scsi_remove_host(cfg->host);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:979:2: note: here
case INIT_STATE_AFU:
^~~~
drivers/scsi/cxlflash/main.c:980:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
term_afu(cfg);
^~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:981:2: note: here
case INIT_STATE_PCI:
^~~~
drivers/scsi/cxlflash/main.c:983:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
pci_disable_device(pdev);
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:984:2: note: here
case INIT_STATE_NONE:
^~~~
drivers/scsi/cxlflash/main.c: In function 'num_hwqs_store':
drivers/scsi/cxlflash/main.c:3018:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (cfg->state == STATE_NORMAL)
^
drivers/scsi/cxlflash/main.c:3020:2: note: here
default:
^~~~~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/scsi/cxlflash/main.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index b1f4724efde2..93ef97af22df 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -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);
@@ -2353,11 +2360,11 @@ static int send_afu_cmd(struct afu *afu, struct sisl_ioarcb *rcb)
cxlflash_schedule_async_reset(cfg);
break;
}
- /* fall through to retry */
+ /* fall through - to retry */
case -EAGAIN:
if (++nretry < 2)
goto retry;
- /* fall through to exit */
+ /* fall through - to exit */
default:
break;
}
@@ -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;
+ /* else, fall through */
default:
/* Ideally should not happen */
dev_err(dev, "%s: Device is not ready, state=%d\n",
--
2.22.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: cxlflash: Mark expected switch fall-throughs
2019-07-29 0:21 [PATCH] scsi: cxlflash: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-29 16:47 ` Kees Cook
2019-07-30 18:52 ` Matthew R. Ochs
2019-07-30 19:59 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2019-07-29 16:47 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, Stephen Rothwell
On Sun, Jul 28, 2019 at 07:21:19PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/scsi/cxlflash/main.c: In function 'send_afu_cmd':
> drivers/scsi/cxlflash/main.c:2347:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (rc) {
> ^
> drivers/scsi/cxlflash/main.c:2357:2: note: here
> case -EAGAIN:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'term_intr':
> drivers/scsi/cxlflash/main.c:754:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (index == PRIMARY_HWQ)
> ^
> drivers/scsi/cxlflash/main.c:756:2: note: here
> case UNMAP_TWO:
> ^~~~
> drivers/scsi/cxlflash/main.c:757:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:758:2: note: here
> case UNMAP_ONE:
> ^~~~
> drivers/scsi/cxlflash/main.c:759:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:760:2: note: here
> case FREE_IRQ:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'cxlflash_remove':
> drivers/scsi/cxlflash/main.c:975:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cxlflash_release_chrdev(cfg);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:976:2: note: here
> case INIT_STATE_SCSI:
> ^~~~
> drivers/scsi/cxlflash/main.c:978:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> scsi_remove_host(cfg->host);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:979:2: note: here
> case INIT_STATE_AFU:
> ^~~~
> drivers/scsi/cxlflash/main.c:980:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> term_afu(cfg);
> ^~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:981:2: note: here
> case INIT_STATE_PCI:
> ^~~~
> drivers/scsi/cxlflash/main.c:983:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> pci_disable_device(pdev);
> ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:984:2: note: here
> case INIT_STATE_NONE:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'num_hwqs_store':
> drivers/scsi/cxlflash/main.c:3018:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (cfg->state == STATE_NORMAL)
> ^
> drivers/scsi/cxlflash/main.c:3020:2: note: here
> default:
> ^~~~~~~
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> drivers/scsi/cxlflash/main.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
> index b1f4724efde2..93ef97af22df 100644
> --- a/drivers/scsi/cxlflash/main.c
> +++ b/drivers/scsi/cxlflash/main.c
> @@ -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);
> @@ -2353,11 +2360,11 @@ static int send_afu_cmd(struct afu *afu, struct sisl_ioarcb *rcb)
> cxlflash_schedule_async_reset(cfg);
> break;
> }
> - /* fall through to retry */
> + /* fall through - to retry */
> case -EAGAIN:
> if (++nretry < 2)
> goto retry;
> - /* fall through to exit */
> + /* fall through - to exit */
> default:
> break;
> }
> @@ -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;
> + /* else, fall through */
> default:
> /* Ideally should not happen */
> dev_err(dev, "%s: Device is not ready, state=%d\n",
> --
> 2.22.0
>
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: cxlflash: Mark expected switch fall-throughs
2019-07-29 0:21 [PATCH] scsi: cxlflash: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:47 ` Kees Cook
@ 2019-07-30 18:52 ` Matthew R. Ochs
2019-07-30 19:59 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Matthew R. Ochs @ 2019-07-30 18:52 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Manoj N. Kumar, Uma Krishnan, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel, Stephen Rothwell,
Kees Cook
On Sun, Jul 28, 2019 at 07:21:19PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/scsi/cxlflash/main.c: In function 'send_afu_cmd':
> drivers/scsi/cxlflash/main.c:2347:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (rc) {
> ^
> drivers/scsi/cxlflash/main.c:2357:2: note: here
> case -EAGAIN:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'term_intr':
> drivers/scsi/cxlflash/main.c:754:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (index == PRIMARY_HWQ)
> ^
> drivers/scsi/cxlflash/main.c:756:2: note: here
> case UNMAP_TWO:
> ^~~~
> drivers/scsi/cxlflash/main.c:757:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 2, hwq);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:758:2: note: here
> case UNMAP_ONE:
> ^~~~
> drivers/scsi/cxlflash/main.c:759:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cfg->ops->unmap_afu_irq(hwq->ctx_cookie, 1, hwq);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:760:2: note: here
> case FREE_IRQ:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'cxlflash_remove':
> drivers/scsi/cxlflash/main.c:975:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> cxlflash_release_chrdev(cfg);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:976:2: note: here
> case INIT_STATE_SCSI:
> ^~~~
> drivers/scsi/cxlflash/main.c:978:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> scsi_remove_host(cfg->host);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:979:2: note: here
> case INIT_STATE_AFU:
> ^~~~
> drivers/scsi/cxlflash/main.c:980:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> term_afu(cfg);
> ^~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:981:2: note: here
> case INIT_STATE_PCI:
> ^~~~
> drivers/scsi/cxlflash/main.c:983:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
> pci_disable_device(pdev);
> ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/cxlflash/main.c:984:2: note: here
> case INIT_STATE_NONE:
> ^~~~
> drivers/scsi/cxlflash/main.c: In function 'num_hwqs_store':
> drivers/scsi/cxlflash/main.c:3018:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (cfg->state == STATE_NORMAL)
> ^
> drivers/scsi/cxlflash/main.c:3020:2: note: here
> default:
> ^~~~~~~
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Matthew R. Ochs <mrochs@linux.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: cxlflash: Mark expected switch fall-throughs
2019-07-29 0:21 [PATCH] scsi: cxlflash: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:47 ` Kees Cook
2019-07-30 18:52 ` Matthew R. Ochs
@ 2019-07-30 19:59 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-07-30 19:59 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan,
James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, Stephen Rothwell, Kees Cook
Gustavo A.,
> Mark switch cases where we are expecting to fall through.
Applied to 5.4/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-30 19:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-29 0:21 [PATCH] scsi: cxlflash: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:47 ` Kees Cook
2019-07-30 18:52 ` Matthew R. Ochs
2019-07-30 19:59 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).