[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <937f46dfacacd354b31440e0842334308edcfe0b.1413021631.git.tilman@imap.cc>
Date: Sat, 11 Oct 2014 13:46:30 +0200 (CEST)
From: Tilman Schmidt <tilman@...p.cc>
To: netdev@...r.kernel.org
Cc: David Miller <davem@...emloft.net>, Dave Jones <davej@...hat.com>,
Hansjoerg Lipp <hjlipp@....de>,
Karsten Keil <isdn@...ux-pingi.de>,
isdn4linux@...tserv.isdn4linux.de
Subject: [PATCH 11/12] 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@...p.cc>
---
drivers/isdn/capi/capiutil.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index 36835ef..36c1b37 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -489,12 +489,17 @@ static char *mnames[] =
* @cmd: command number
* @subcmd: subcommand number
*
- * Return value: static string, NULL if command/subcommand unknown
+ * Return value: static string
*/
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;
}
--
1.9.2.459.g68773ac
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists