public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: outreachy-kernel <outreachy-kernel@googlegroups.com>,
	w.d.hubbs@gmail.com, chris@the-brannons.com, kirk@reisers.ca,
	samuel.thibault@ens-lyon.org, gregkh@linuxfoundation.org,
	speakup@linux-speakup.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH] staging: speakup: else is not generally useful after a break or return
Date: Fri, 3 Mar 2017 17:54:02 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1703031753460.3490@hadrien> (raw)
In-Reply-To: <cc06f004-d16e-4e67-86fb-5e1b099c811a@googlegroups.com>

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



On Fri, 3 Mar 2017, Arushi Singhal wrote:

>
>
> On Friday, March 3, 2017 at 9:33:22 PM UTC+5:30, Julia Lawall wrote:
>
>
>       On Fri, 3 Mar 2017, Arushi Singhal wrote:
>
>       > fixed checkpatch.pl warning: else is not generally useful
>       after a break
>       > or return.
>       > Removed the else without affecting the logic.
>       > Dead code is also eliminated.
>
>       The chhange is not correct.  There is a big chain of if/else if.
>        The if
>       (type == KT_LATIN) can reach the code at the end of the file.
>
> If there is else and all if/else have return statement so then the code will
> not reach at the end.

The first one does not end in a return.

julia

>  Thanks
> Aruhsi
>       \
>       julia
>
>       >
>       > Signed-off-by: Arushi Singhal <arushising...@gmail.com>
>       > ---
>       >  drivers/staging/speakup/keyhelp.c | 53
>       ++++++++++++++-------------------------
>       >  1 file changed, 19 insertions(+), 34 deletions(-)
>       >
>       > diff --git a/drivers/staging/speakup/keyhelp.c
>       b/drivers/staging/speakup/keyhelp.c
>       > index 4e6e5daba50c..ad3efded37c1 100644
>       > --- a/drivers/staging/speakup/keyhelp.c
>       > +++ b/drivers/staging/speakup/keyhelp.c
>       > @@ -176,43 +176,28 @@ int spk_handle_help(struct vc_data *vc,
>       u_char type, u_char ch, u_short key)
>       >                  synth_printf("%s\n",
>       spk_msg_get(MSG_HELP_INFO));
>       >                  build_key_data(); /* rebuild each time in
>       case new mapping */
>       >                  return 1;
>       > -        } else {
>       > -                name = NULL;
>       > -                if ((type != KT_SPKUP) && (key > 0) && (key
>       <= num_key_names)) {
>       > -                        synth_printf("%s\n",
>       > -                                    
>       spk_msg_get(MSG_KEYNAMES_START + key - 1));
>       > -                        return 1;
>       > -                }
>       > -                for (i = 0; funcvals[i] != 0 && !name; i++) {
>       > -                        if (ch == funcvals[i])
>       > -                                name =
>       spk_msg_get(MSG_FUNCNAMES_START + i);
>       > -                }
>       > -                if (!name)
>       > -                        return -1;
>       > -                kp = spk_our_keys[key] + 1;
>       > -                for (i = 0; i < nstates; i++) {
>       > -                        if (ch == kp[i])
>       > -                                break;
>       > -                }
>       > -                key += (state_tbl[i] << 8);
>       > -                say_key(key);
>       > -                synth_printf(spk_msg_get(MSG_KEYDESC), name);
>       > -                synth_printf("\n");
>       > -                return 1;
>       >          }
>       > -        name = spk_msg_get(MSG_FUNCNAMES_START + cur_item);
>       > -        func = funcvals[cur_item];
>       > -        synth_printf("%s", name);
>       > -        if (key_offsets[func] == 0) {
>       > -                synth_printf(" %s\n",
>       spk_msg_get(MSG_IS_UNASSIGNED));
>       > +
>       > +        name = NULL;
>       > +        if ((type != KT_SPKUP) && (key > 0) && (key <=
>       num_key_names)) {
>       > +                synth_printf("%s\n",
>       > +                             spk_msg_get(MSG_KEYNAMES_START +
>       key - 1));
>       >                  return 1;
>       >          }
>       > -        p_keys = key_data + key_offsets[func];
>       > -        for (n = 0; p_keys[n]; n++) {
>       > -                val = p_keys[n];
>       > -                if (n > 0)
>       > -                        synth_printf("%s ",
>       spk_msg_get(MSG_DISJUNCTION));
>       > -                say_key(val);
>       > +        for (i = 0; funcvals[i] != 0 && !name; i++) {
>       > +                if (ch == funcvals[i])
>       > +                        name =
>       spk_msg_get(MSG_FUNCNAMES_START + i);
>       > +        }
>       > +        if (!name)
>       > +                return -1;
>       > +        kp = spk_our_keys[key] + 1;
>       > +        for (i = 0; i < nstates; i++) {
>       > +                if (ch == kp[i])
>       > +                        break;
>       >          }
>       > +        key += (state_tbl[i] << 8);
>       > +        say_key(key);
>       > +        synth_printf(spk_msg_get(MSG_KEYDESC), name);
>       > +        synth_printf("\n");
>       >          return 1;
>       >  }
>       > --
>       > 2.11.0
>       >
>       > --
>       > You received this message because you are subscribed to the
>       Google Groups "outreachy-kernel" group.
>       > To unsubscribe from this group and stop receiving emails from
>       it, send an email to outreachy-kern...@googlegroups.com.
>       > To post to this group, send email to
>       outreach...@googlegroups.com.
>       > To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/20170303155557.GA23744%4
>       0arushi-HP-Pavilion-Notebook.
>       > For more options, visit https://groups.google.com/d/optout.
>       >
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/cc06f004-d16e-4e67-86fb-
> 5e1b099c811a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

  parent reply	other threads:[~2017-03-03 16:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 15:55 [PATCH] staging: speakup: else is not generally useful after a break or return Arushi Singhal
2017-03-03 16:03 ` [Outreachy kernel] " Julia Lawall
     [not found]   ` <cc06f004-d16e-4e67-86fb-5e1b099c811a@googlegroups.com>
2017-03-03 16:54     ` Julia Lawall [this message]
2017-03-03 17:48   ` Dan Carpenter
2017-03-06 12:59 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1703031753460.3490@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=arushisinghal19971997@gmail.com \
    --cc=chris@the-brannons.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    --cc=w.d.hubbs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox