summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNagaraj <c_lnun@qca.qualcomm.com>2014-10-15 16:08:56 -0700
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2014-10-16 17:03:11 +0530
commit05520b4c2deb4a72f40c9fadb5d12bb7fa663f14 (patch)
tree1853f18e469910c70bc1adf14385a712e2ce8092 /tools
parent7bba190491d3e8779b699acf8e246a73a6193cd1 (diff)
cnss_diag: Added a null pointer check for debugprint
Added a null pointer check before printing debug print. Fixed a indentation issue and removed redundant function. Change-Id: I38065c4eccac6ad76812f1712a1633c27b21957d CRs-fixed: 739844
Diffstat (limited to 'tools')
-rw-r--r--tools/fwdebuglog/cld-diag-parser.c52
-rw-r--r--tools/fwdebuglog/cld-diag-parser.h9
2 files changed, 30 insertions, 31 deletions
diff --git a/tools/fwdebuglog/cld-diag-parser.c b/tools/fwdebuglog/cld-diag-parser.c
index de418397658a..3f3f45dd1a73 100644
--- a/tools/fwdebuglog/cld-diag-parser.c
+++ b/tools/fwdebuglog/cld-diag-parser.c
@@ -837,6 +837,8 @@ process_diaghost_msg(uint8_t *datap, uint16_t len)
{
uint8_t *payload;
event_report_t *pEvent_report =(event_report_t *)datap ;
+ if (!pEvent_report)
+ return;
debug_printf("\n %s diag_type = %d event_id =%d\n",
__func__, pEvent_report->diag_type,
pEvent_report->event_id);
@@ -876,7 +878,7 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag,
memset(dump_buffer, 0, sizeof(dump_buffer));
debug_printf("process_diagfw_msg hex dump start len %d", len);
for (i = 0; i < len; i++) {
- ret = snprintf(dump_buffer + j,BUF_SIZ, "0x%x ", debugp[i]);
+ ret = snprintf(dump_buffer + j, BUF_SIZ - j, "0x%x ", debugp[i]);
j += ret;
if (!(i % 16) && (i!=0)) {
total_dump_len += 16;
@@ -977,9 +979,11 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag,
}
entry = diag_find_by_id(id);
if (entry) {
- debug_printf(" entry->format = %s pack = %s\n",
+ if (entry->format && entry->pack) {
+ debug_printf("entry->format = %s pack = %s\n",
entry->format, entry->pack);
- if ((payloadlen > 0) && entry->pack) {
+ }
+ if ((payloadlen > 0) && entry->pack) {
if (payloadlen < BUF_SIZ)
memcpy(payload_buf, payload, payloadlen);
else
@@ -1001,29 +1005,29 @@ process_diagfw_msg(uint8_t *datap, uint16_t len, uint32_t optionflag,
(uint8_t*)entry->msg,
entry->msg_len
);
- }
- else
- strlcpy(buf, entry->format, strlen(entry->format));
-
- debug_printf("\n buf = %s \n", buf);
- if (optionflag & LOGFILE_FLAG) {
- lrecord = *record;
- lrecord++;
- if (!((optionflag & SILENT_FLAG) == SILENT_FLAG))
- printf("%d: %s\n", lrecord, buf);
-
- res = diag_printf(
+ }
+ else if (entry->format)
+ strlcpy(buf, entry->format, strlen(entry->format));
+
+ debug_printf("\n buf = %s \n", buf);
+ if (optionflag & LOGFILE_FLAG) {
+ lrecord = *record;
+ lrecord++;
+ if (!((optionflag & SILENT_FLAG) == SILENT_FLAG))
+ printf("%d: %s\n", lrecord, buf);
+
+ res = diag_printf(
buf, vdevid, vdevlevel, optionflag, timestamp, log_out
);
- //fseek(log_out, lrecord * res, SEEK_SET);
- if (lrecord == max_records) {
- lrecord = 0;
- fseek(log_out, lrecord * res, SEEK_SET);
- }
- *record = lrecord;
- }
- if (optionflag & (CONSOLE_FLAG | QXDM_FLAG))
- diag_printf(
+ //fseek(log_out, lrecord * res, SEEK_SET);
+ if (lrecord == max_records) {
+ lrecord = 0;
+ fseek(log_out, lrecord * res, SEEK_SET);
+ }
+ *record = lrecord;
+ }
+ if (optionflag & (CONSOLE_FLAG | QXDM_FLAG))
+ diag_printf(
buf, vdevid, vdevlevel, optionflag, timestamp, NULL
);
}
diff --git a/tools/fwdebuglog/cld-diag-parser.h b/tools/fwdebuglog/cld-diag-parser.h
index 1c3dcdaa2eb9..9cb742a2c1be 100644
--- a/tools/fwdebuglog/cld-diag-parser.h
+++ b/tools/fwdebuglog/cld-diag-parser.h
@@ -133,7 +133,7 @@
#define CONSOLE_FLAG 0x02
#define QXDM_FLAG 0x04
#define SILENT_FLAG 0x08
-#define DEBUG_FLAG 0x0A
+#define DEBUG_FLAG 0x10
#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500
@@ -261,11 +261,6 @@ static inline unsigned int aniNlAlign(unsigned int len)
return ((len + ANI_NL_MASK) & ~ANI_NL_MASK);
}
-static inline void *aniNlAlignBuf(void *buf)
-{
- return (void *)aniNlAlign((unsigned int)buf);
-}
-
/*
* Determines the aligned length of the WNI MSG including the hdr
* for a given payload of length 'len'.
@@ -275,7 +270,7 @@ static inline unsigned int aniNlLen(unsigned int len)
return (aniNlAlign(sizeof(tAniHdr)) + len);
}
-/* KENEL DEFS END */
+/* KERNEL DEFS END */
#define WLAN_NL_MSG_CNSS_DIAG 27 /* Msg type between user space/wlan driver */
#define WLAN_NL_MSG_CNSS_HOST_MSG 28