linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs
@ 2018-08-15 17:10 Gustavo A. R. Silva
  2018-08-17 15:32 ` Vladimir Zapolskiy
  2018-08-29 11:47 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2018-08-15 17:10 UTC (permalink / raw)
  To: Linus Walleij, Joachim Eastwood
  Cc: linux-gpio, linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

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

Addresses-Coverity-ID: 1292308 ("Missing break in switch")
Addresses-Coverity-ID: 1292309 ("Missing break in switch")
Addresses-Coverity-ID: 1309546 ("Missing break in switch")
Addresses-Coverity-ID: 1357369 ("Missing break in switch")
Addresses-Coverity-ID: 1357389 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/pinctrl/pinctrl-lpc18xx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c
index 190f17e..a14bc5e 100644
--- a/drivers/pinctrl/pinctrl-lpc18xx.c
+++ b/drivers/pinctrl/pinctrl-lpc18xx.c
@@ -844,8 +844,11 @@ static int lpc18xx_pconf_get_pin(struct pinctrl_dev *pctldev, unsigned param,
 		*arg = (reg & LPC18XX_SCU_PIN_EHD_MASK) >> LPC18XX_SCU_PIN_EHD_POS;
 		switch (*arg) {
 		case 3: *arg += 5;
+			/* fall through */
 		case 2: *arg += 5;
+			/* fall through */
 		case 1: *arg += 3;
+			/* fall through */
 		case 0: *arg += 4;
 		}
 		break;
@@ -1060,8 +1063,11 @@ static int lpc18xx_pconf_set_pin(struct pinctrl_dev *pctldev, unsigned param,
 
 		switch (param_val) {
 		case 20: param_val -= 5;
+			 /* fall through */
 		case 14: param_val -= 5;
+			 /* fall through */
 		case  8: param_val -= 3;
+			 /* fall through */
 		case  4: param_val -= 4;
 			 break;
 		default:
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs
  2018-08-15 17:10 [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2018-08-17 15:32 ` Vladimir Zapolskiy
  2018-08-29 11:47 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2018-08-17 15:32 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Linus Walleij, Joachim Eastwood
  Cc: linux-gpio, linux-arm-kernel, linux-kernel

On 08/15/2018 08:10 PM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Addresses-Coverity-ID: 1292308 ("Missing break in switch")
> Addresses-Coverity-ID: 1292309 ("Missing break in switch")
> Addresses-Coverity-ID: 1309546 ("Missing break in switch")
> Addresses-Coverity-ID: 1357369 ("Missing break in switch")
> Addresses-Coverity-ID: 1357389 ("Missing break in switch")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/pinctrl/pinctrl-lpc18xx.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c
> index 190f17e..a14bc5e 100644
> --- a/drivers/pinctrl/pinctrl-lpc18xx.c
> +++ b/drivers/pinctrl/pinctrl-lpc18xx.c
> @@ -844,8 +844,11 @@ static int lpc18xx_pconf_get_pin(struct pinctrl_dev *pctldev, unsigned param,
>  		*arg = (reg & LPC18XX_SCU_PIN_EHD_MASK) >> LPC18XX_SCU_PIN_EHD_POS;
>  		switch (*arg) {
>  		case 3: *arg += 5;
> +			/* fall through */
>  		case 2: *arg += 5;
> +			/* fall through */
>  		case 1: *arg += 3;
> +			/* fall through */
>  		case 0: *arg += 4;
>  		}
>  		break;
> @@ -1060,8 +1063,11 @@ static int lpc18xx_pconf_set_pin(struct pinctrl_dev *pctldev, unsigned param,
>  
>  		switch (param_val) {
>  		case 20: param_val -= 5;
> +			 /* fall through */
>  		case 14: param_val -= 5;
> +			 /* fall through */
>  		case  8: param_val -= 3;
> +			 /* fall through */
>  		case  4: param_val -= 4;
>  			 break;
>  		default:
> 

The code snippets are about a mind-blowing hyper-optimization, but I took
it as a chance to verify the correctness, and there are no issues found.

Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>

--
Best wishes,
Vladimir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs
  2018-08-15 17:10 [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs Gustavo A. R. Silva
  2018-08-17 15:32 ` Vladimir Zapolskiy
@ 2018-08-29 11:47 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-08-29 11:47 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Joachim Eastwood, open list:GPIO SUBSYSTEM, Linux ARM, linux-kernel

On Wed, Aug 15, 2018 at 7:10 PM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:

> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Addresses-Coverity-ID: 1292308 ("Missing break in switch")
> Addresses-Coverity-ID: 1292309 ("Missing break in switch")
> Addresses-Coverity-ID: 1309546 ("Missing break in switch")
> Addresses-Coverity-ID: 1357369 ("Missing break in switch")
> Addresses-Coverity-ID: 1357389 ("Missing break in switch")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-29 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 17:10 [PATCH] pinctrl: lpc18xx: mark expected switch fall-throughs Gustavo A. R. Silva
2018-08-17 15:32 ` Vladimir Zapolskiy
2018-08-29 11:47 ` Linus Walleij

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).