linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: adav80x: mark expected switch fall-through
@ 2018-08-08 19:19 Gustavo A. R. Silva
  2018-08-09  9:30 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-08-08 19:19 UTC (permalink / raw)
  To: Lars-Peter Clausen, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: alsa-devel, 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: 1056531 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 sound/soc/codecs/adav80x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index db21ecb..8b9ca7e 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -648,6 +648,7 @@ static int adav80x_set_pll(struct snd_soc_component *component, int pll_id,
 			pll_ctrl1 |= ADAV80X_PLL_CTRL1_PLLDIV;
 			break;
 		}
+		/* fall through */
 	default:
 		return -EINVAL;
 	}
-- 
2.7.4


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

* Re: [PATCH] ASoC: adav80x: mark expected switch fall-through
  2018-08-08 19:19 [PATCH] ASoC: adav80x: mark expected switch fall-through Gustavo A. R. Silva
@ 2018-08-09  9:30 ` Mark Brown
  2018-08-09 11:23   ` [alsa-devel] " Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2018-08-09  9:30 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Lars-Peter Clausen, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

On Wed, Aug 08, 2018 at 02:19:33PM -0500, Gustavo A. R. Silva wrote:

> @@ -648,6 +648,7 @@ static int adav80x_set_pll(struct snd_soc_component *component, int pll_id,
>  			pll_ctrl1 |= ADAV80X_PLL_CTRL1_PLLDIV;
>  			break;
>  		}
> +		/* fall through */
>  	default:
>  		return -EINVAL;
>  	}

Are you *positive* this is a deliberate fall through?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [alsa-devel] [PATCH] ASoC: adav80x: mark expected switch fall-through
  2018-08-09  9:30 ` Mark Brown
@ 2018-08-09 11:23   ` Lars-Peter Clausen
  2018-08-09 13:46     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2018-08-09 11:23 UTC (permalink / raw)
  To: Mark Brown, Gustavo A. R. Silva
  Cc: alsa-devel, Liam Girdwood, linux-kernel, Takashi Iwai

On 08/09/2018 11:30 AM, Mark Brown wrote:
> On Wed, Aug 08, 2018 at 02:19:33PM -0500, Gustavo A. R. Silva wrote:
> 
>> @@ -648,6 +648,7 @@ static int adav80x_set_pll(struct snd_soc_component *component, int pll_id,
>>  			pll_ctrl1 |= ADAV80X_PLL_CTRL1_PLLDIV;
>>  			break;
>>  		}
>> +		/* fall through */
>>  	default:
>>  		return -EINVAL;
>>  	}
> 
> Are you *positive* this is a deliberate fall through?

It is. But it might make sense to re-order the code to look like

    case 54000000:
        if (source != ADAV80X_PLL_SRC_XIN)
            return -EINVAL;

        pll_ctrl1 |= ADAV80X_PLL_CTRL1_PLLDIV;
        break;

It is just as many lines added when adding the /* fall through */, but it
makes it more obvious what is going on.

Either way:

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

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

* Re: [alsa-devel] [PATCH] ASoC: adav80x: mark expected switch fall-through
  2018-08-09 11:23   ` [alsa-devel] " Lars-Peter Clausen
@ 2018-08-09 13:46     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-08-09 13:46 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Gustavo A. R. Silva, alsa-devel, Liam Girdwood, linux-kernel,
	Takashi Iwai

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

On Thu, Aug 09, 2018 at 01:23:58PM +0200, Lars-Peter Clausen wrote:
> On 08/09/2018 11:30 AM, Mark Brown wrote:

> It is. But it might make sense to re-order the code to look like
> 
>     case 54000000:
>         if (source != ADAV80X_PLL_SRC_XIN)
>             return -EINVAL;
> 
>         pll_ctrl1 |= ADAV80X_PLL_CTRL1_PLLDIV;
>         break;

> It is just as many lines added when adding the /* fall through */, but it
> makes it more obvious what is going on.

Yes, it's much more obvious.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-08-09 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 19:19 [PATCH] ASoC: adav80x: mark expected switch fall-through Gustavo A. R. Silva
2018-08-09  9:30 ` Mark Brown
2018-08-09 11:23   ` [alsa-devel] " Lars-Peter Clausen
2018-08-09 13:46     ` Mark Brown

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