2019-01-14 20:43:22

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH] vt: annotate implicit fall throughs

There is a plan to build the kernel with -Wimplicit-fallthrough and
these places in the code produced warnings (W=1). Fix them up.

This commit remove the following warning:

drivers/tty/vt/vt.c:2112:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/tty/vt/vt.c:2237:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
drivers/tty/vt/vt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 41ec8e5010f3..e4f8caed26af 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2111,6 +2111,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
lf(vc);
if (!is_kbd(vc, lnm))
return;
+ /* fall through */
case 13:
cr(vc);
return;
@@ -2236,6 +2237,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
vc->vc_ques = (c == '?');
if (vc->vc_ques)
return;
+ /* fall through */
case ESgetpars:
if (c == ';' && vc->vc_npar < NPAR - 1) {
vc->vc_npar++;
--
2.19.2



2019-01-14 20:53:09

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] vt: annotate implicit fall throughs



On 1/14/19 2:41 PM, Mathieu Malaterre wrote:
> There is a plan to build the kernel with -Wimplicit-fallthrough and
> these places in the code produced warnings (W=1). Fix them up.
>
> This commit remove the following warning:
>
> drivers/tty/vt/vt.c:2112:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> drivers/tty/vt/vt.c:2237:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Acked-by: Gustavo A. R. Silva <[email protected]>

Thanks, Mathieu.

--
Gustavo

> ---
> drivers/tty/vt/vt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 41ec8e5010f3..e4f8caed26af 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -2111,6 +2111,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
> lf(vc);
> if (!is_kbd(vc, lnm))
> return;
> + /* fall through */
> case 13:
> cr(vc);
> return;
> @@ -2236,6 +2237,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
> vc->vc_ques = (c == '?');
> if (vc->vc_ques)
> return;
> + /* fall through */
> case ESgetpars:
> if (c == ';' && vc->vc_npar < NPAR - 1) {
> vc->vc_npar++;
>