Commit 340184b3 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by David S. Miller

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: default avatarTilman Schmidt <tilman@imap.cc>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2bf3a09e
...@@ -489,12 +489,17 @@ static char *mnames[] = ...@@ -489,12 +489,17 @@ static char *mnames[] =
* @cmd: command number * @cmd: command number
* @subcmd: subcommand number * @subcmd: subcommand number
* *
* Return value: static string, NULL if command/subcommand unknown * Return value: static string
*/ */
char *capi_cmd2str(u8 cmd, u8 subcmd) char *capi_cmd2str(u8 cmd, u8 subcmd)
{ {
return mnames[command_2_index(cmd, subcmd)]; char *result;
result = mnames[command_2_index(cmd, subcmd)];
if (result == NULL)
result = "INVALID_COMMAND";
return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment