From: Arushi Singhal <arushisinghal19971997@gmail.com>
To: w.d.hubbs@gmail.com
Cc: Chris Brannon <chris@the-brannons.com>,
Kirk Reiser <kirk@reisers.ca>,
Samuel Thibault <samuel.thibault@ens-lyon.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
speakup@linux-speakup.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com
Subject: [PATCH] staging: speakup: else is not generally useful after a break or return
Date: Fri, 3 Mar 2017 21:25:57 +0530 [thread overview]
Message-ID: <20170303155557.GA23744@arushi-HP-Pavilion-Notebook> (raw)
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.
Signed-off-by: Arushi Singhal <arushisinghal19971997@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
next reply other threads:[~2017-03-03 18:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 15:55 Arushi Singhal [this message]
2017-03-03 16:03 ` [Outreachy kernel] [PATCH] staging: speakup: else is not generally useful after a break or return Julia Lawall
[not found] ` <cc06f004-d16e-4e67-86fb-5e1b099c811a@googlegroups.com>
2017-03-03 16:54 ` Julia Lawall
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=20170303155557.GA23744@arushi-HP-Pavilion-Notebook \
--to=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