kgdb patches for 5.13

Exclusively tidy ups this cycle. Most of them are thanks to Sumit Garg
and, as it happens, the clean ups do result in a slight increase in
the line count. This is due to registering kdb commands using data
structures rather than function calls which, in turn, simplifies the
memory management during command registration.

In addition to changes to command registration we also have some dead
code removal, a clearer implementation of environment variable handling
and a typo fix.

Signed-off-by: Daniel Thompson <>
kdb: Refactor env variables get/set code

Add two new kdb environment access methods as kdb_setenv() and
kdb_printenv() in order to abstract out environment access code
from kdb command functions.

Also, replace (char *)0 with NULL as an initializer for environment
variables array.

Signed-off-by: Sumit Garg <>
Reviewed-by: Douglas Anderson <>
[ Replaced (char *)0/NULL initializers with
an array size]
Signed-off-by: Daniel Thompson <>
1 file changed