public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis de Bethencourt <luis@debethencourt.com>
To: linux-kernel@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	William Hubbs <w.d.hubbs@gmail.com>,
	Chris Brannon <chris@the-brannons.com>,
	Kirk Reiser <kirk@reisers.ca>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Domagoj Trsan <domagoj.trsan@gmail.com>,
	speakup@linux-speakup.org, devel@driverdev.osuosl.org
Subject: [PATCH 2/2] staging: speakup: else is not useful after a return
Date: Thu, 25 Jun 2015 14:56:52 +0200	[thread overview]
Message-ID: <20150625125650.GA20230@goodgumbo.baconseed.org> (raw)

Correct a checkpatch.pl warning regarding
WARNING: else is not generally useful after a break or return
drivers/staging/speakup/keyhelp.c:185:

Changing the order of the if blocks, but not the logic, to avoid this
warning. The block after else will run if the blocks KT_CUR or KT_LATIN
set cur_item instead of returning.

Signed-off-by: Luis de Bethencourt <luis@debethencourt.com>
---
 drivers/staging/speakup/keyhelp.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c
index 02d5c70..8133b6e 100644
--- a/drivers/staging/speakup/keyhelp.c
+++ b/drivers/staging/speakup/keyhelp.c
@@ -151,22 +151,7 @@ int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key)
 
 	if (letter_offsets[0] == -1)
 		help_init();
-	if (type == KT_LATIN) {
-		if (ch == SPACE) {
-			spk_special_handler = NULL;
-			synth_printf("%s\n", spk_msg_get(MSG_LEAVING_HELP));
-			return 1;
-		}
-		ch |= 32; /* lower case */
-		if (ch < 'a' || ch > 'z')
-			return -1;
-		if (letter_offsets[ch-'a'] == -1) {
-			synth_printf(spk_msg_get(MSG_NO_COMMAND), ch);
-			synth_printf("\n");
-			return 1;
-		}
-		cur_item = letter_offsets[ch-'a'];
-	} else if (type == KT_CUR) {
+	if (type == KT_CUR) {
 		if (ch == 0
 		    && (MSG_FUNCNAMES_START + cur_item + 1) <=
 		    MSG_FUNCNAMES_END)
@@ -182,6 +167,21 @@ 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 if (type == KT_LATIN) {
+		if (ch == SPACE) {
+			spk_special_handler = NULL;
+			synth_printf("%s\n", spk_msg_get(MSG_LEAVING_HELP));
+			return 1;
+		}
+		ch |= 32; /* lower case */
+		if (ch < 'a' || ch > 'z')
+			return -1;
+		if (letter_offsets[ch-'a'] == -1) {
+			synth_printf(spk_msg_get(MSG_NO_COMMAND), ch);
+			synth_printf("\n");
+			return 1;
+		}
+		cur_item = letter_offsets[ch-'a'];
 	} else {
 		name = NULL;
 		if ((type != KT_SPKUP) && (key > 0) && (key <= num_key_names)) {
-- 
2.1.4


             reply	other threads:[~2015-06-25 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 12:56 Luis de Bethencourt [this message]
2015-07-15  3:01 ` [PATCH 2/2] staging: speakup: else is not useful after a return Greg Kroah-Hartman

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=20150625125650.GA20230@goodgumbo.baconseed.org \
    --to=luis@debethencourt.com \
    --cc=chris@the-brannons.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=domagoj.trsan@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --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