diff options
author | Tilman Schmidt <tilman@imap.cc> | 2014-10-11 07:46:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-14 15:05:35 -0400 |
commit | 340184b35ac8786bdb574d2c8ce8e4f1269ec4da (patch) | |
tree | 476198dccf63ead3c26d49ce496c429e24d4a0bf /drivers/isdn/capi | |
parent | 2bf3a09ea51f807d78d48d0ebc591b9e1502a743 (diff) |
isdn/capi: don't return NULL from capi_cmd2str()
capi_cmd2str() is used in many places to build log messages.
None of them is prepared to handle NULL as a result.
Change the function to return printable string "INVALID_COMMAND"
instead.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r-- | drivers/isdn/capi/capiutil.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index 36835ef3f340..36c1b37cea0a 100644 --- a/drivers/isdn/capi/capiutil.c +++ b/drivers/isdn/capi/capiutil.c | |||
@@ -489,12 +489,17 @@ static char *mnames[] = | |||
489 | * @cmd: command number | 489 | * @cmd: command number |
490 | * @subcmd: subcommand number | 490 | * @subcmd: subcommand number |
491 | * | 491 | * |
492 | * Return value: static string, NULL if command/subcommand unknown | 492 | * Return value: static string |
493 | */ | 493 | */ |
494 | 494 | ||
495 | char *capi_cmd2str(u8 cmd, u8 subcmd) | 495 | char *capi_cmd2str(u8 cmd, u8 subcmd) |
496 | { | 496 | { |
497 | return mnames[command_2_index(cmd, subcmd)]; | 497 | char *result; |
498 | |||
499 | result = mnames[command_2_index(cmd, subcmd)]; | ||
500 | if (result == NULL) | ||
501 | result = "INVALID_COMMAND"; | ||
502 | return result; | ||
498 | } | 503 | } |
499 | 504 | ||
500 | 505 | ||