kdb: Get rid of confusing diag msg from "rd" if current task has no regs
authorDouglas Anderson <dianders@chromium.org>
Sat, 9 Nov 2019 19:16:44 +0000 (11:16 -0800)
committerDaniel Thompson <daniel.thompson@linaro.org>
Fri, 31 Jan 2020 17:34:03 +0000 (17:34 +0000)
commitbbfceba15f8d1260c328a254efc2b3f2deae4904
tree7a5a1d1bfa085a2ac07ede27a2af6c7c0c0189fc
parent9441d5f6b77770ee388884f04b14a99b028a15e6
kdb: Get rid of confusing diag msg from "rd" if current task has no regs

If you switch to a sleeping task with the "pid" command and then type
"rd", kdb tells you this:

  No current kdb registers.  You may need to select another task
  diag: -17: Invalid register name

The first message makes sense, but not the second.  Fix it by just
returning 0 after commands accessing the current registers finish if
we've already printed the "No current kdb registers" error.

While fixing kdb_rd(), change the function to use "if" rather than
"ifdef".  It cleans the function up a bit and any modern compiler will
have no trouble handling still producing good code.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20191109111624.5.I121f4c6f0c19266200bf6ef003de78841e5bfc3d@changeid
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_main.c