Skip to contentSkip to conversation

Staging: speakup: Remove unnecessary else after return

PATCH In review Dilek Uzulmez 2 participants 2 messages Feb 20, 2015 – Feb 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: speakup: Remove unnecessary else after return

This patch fixes checkpatch.pl warning in files of speakup
WARNING: else is not generally useful after a break or return

Changes since v2:
* "}" was added and was shifted to the left.

---
 drivers/staging/speakup/keyhelp.c | 67 ++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 33 deletions(-)
drivers/staging/speakup/keyhelp.c +34 -33
index 832cf00..99e16ed 100644
@@ -182,42 +182,43 @@ 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;
-		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;
+}
+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));
 	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);
+}
+return 1;
+}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Dilek Uzulmez

This patch fixes checkpatch.pl warning in files of speakup
WARNING: else is not generally useful after a break or return

Changes since v2:
* "}" was added and was shifted to the left.

This information should be below the ---. This information is not meaningful to anyone who reads the patch in the future, because the previous version will not be preserved. The text that you put below the --- and above thepatch is also thrown away.

The change is also not since v2, it is in v2.

Finally, your patch seems to be against your previous patch, not against the original code. It should be against the original code.

julia

Quoted 96 lines
---
 drivers/staging/speakup/keyhelp.c | 67 ++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 33 deletions(-)
drivers/staging/speakup/keyhelp.c +34 -33
index 832cf00..99e16ed 100644
@@ -182,42 +182,43 @@ 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;
-		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;
+}
+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));
 	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);
+}
+return 1;
+}
Signature · 8 lines
1.9.1

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424474060-16367-1-git-send-email-dilekuzulmez%40gmail.com.
For more options, visit https://groups.google.com/d/optout.