Skip to content

Commit 6244917

Browse files
author
Daniel Thompson
committed
kdb: Merge identical case statements in kdb_read()
The code that handles case 14 (down) and case 16 (up) has been copy and pasted despite being byte-for-byte identical. Combine them. Cc: stable@vger.kernel.org # Not a bug fix but it is needed for later bug fixes Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Justin Stitt <justinstitt@google.com> Link: https://lore.kernel.org/r/20240424-kgdb_read_refactor-v3-4-f236dbe9828d@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
1 parent db2f9c7 commit 6244917

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

kernel/debug/kdb/kdb_io.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static char *kdb_read(char *buffer, size_t bufsize)
317317
}
318318
break;
319319
case 14: /* Down */
320+
case 16: /* Up */
320321
memset(tmpbuffer, ' ',
321322
strlen(kdb_prompt_str) + (lastchar-buffer));
322323
*(tmpbuffer+strlen(kdb_prompt_str) +
@@ -331,15 +332,6 @@ static char *kdb_read(char *buffer, size_t bufsize)
331332
++cp;
332333
}
333334
break;
334-
case 16: /* Up */
335-
memset(tmpbuffer, ' ',
336-
strlen(kdb_prompt_str) + (lastchar-buffer));
337-
*(tmpbuffer+strlen(kdb_prompt_str) +
338-
(lastchar-buffer)) = '\0';
339-
kdb_printf("\r%s\r", tmpbuffer);
340-
*lastchar = (char)key;
341-
*(lastchar+1) = '\0';
342-
return lastchar;
343335
case 9: /* Tab */
344336
if (tab < 2)
345337
++tab;

0 commit comments

Comments
 (0)