kdb: Fix "btc <cpu>" crash if the CPU didn't round up
authorDouglas Anderson <dianders@chromium.org>
Wed, 25 Sep 2019 20:02:19 +0000 (13:02 -0700)
committerDaniel Thompson <daniel.thompson@linaro.org>
Thu, 10 Oct 2019 15:28:14 +0000 (16:28 +0100)
commit55a7e23f461fc2c321d7efcdeca1750085e9323f
treedc737299227f925508a3f5ed2d4ac4bad3149e52
parent54af3e39eed7d77f0923511f3c7f446e7d477635
kdb: Fix "btc <cpu>" crash if the CPU didn't round up

I noticed that when I did "btc <cpu>" and the CPU I passed in hadn't
rounded up that I'd crash.  I was going to copy the same fix from
commit 162bc7f5afd7 ("kdb: Don't back trace on a cpu that didn't round
up") into the "not all the CPUs" case, but decided it'd be better to
clean things up a little bit.

This consolidates the two code paths.  It is _slightly_ wasteful in in
that the checks for "cpu" being too small or being offline isn't
really needed when we're iterating over all online CPUs, but that
really shouldn't hurt.  Better to have the same code path.

While at it, eliminate at least one slightly ugly (and totally
needless) recursive use of kdb_parse().

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_bt.c