[DTV00925143] misc: fix coverity issue
[Description]
Fix CID
4181347: Dereference before null check, nicCmdEventGetTxPwrTbl()
4181351: Resource leak, procGetTxpwrTblRead()
4181352: Dead default in switch, print_txpwr_tbl()
4181359: Logically dead code, priv_driver_coex_ctrl()
Change-Id: I467a049331bc0d1ee7fbf6d4649fc958e5099fbc
CR-Id: DTV00925143
Signed-off-by: guo-jie.wang <guo-jie.wang@mediatek.com>
Feature: misc
Reviewed-on: http://gerrit.mediatek.inc:8080/1300818
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: George Kuo <george.kuo@mediatek.com>
Reviewed-by: Sarick Jiang <sarick.jiang@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
Test: srv_neptune_adm <srv_neptune_adm@mediatek.com>
diff --git a/nic/nic_cmd_event.c b/nic/nic_cmd_event.c
index 37adaaf..4fd07c9 100644
--- a/nic/nic_cmd_event.c
+++ b/nic/nic_cmd_event.c
@@ -3597,21 +3597,30 @@
struct PARAM_CMD_GET_TXPWR_TBL *prTxPwrTbl = NULL;
void *info_buf = NULL;
- ASSERT(prAdapter);
- ASSERT(prCmdInfo);
- ASSERT(pucEventBuf);
- ASSERT(prCmdInfo->pvInformationBuffer);
-
- if (!prCmdInfo)
+ if (!prAdapter) {
+ DBGLOG(NIC, ERROR, "NULL prAdapter!\n");
return;
+ }
- if (!prAdapter || !pucEventBuf || !prCmdInfo->pvInformationBuffer) {
+ if (!prCmdInfo) {
+ DBGLOG(NIC, ERROR, "NULL prCmdInfo!\n");
+ return;
+ }
+
+ if (!pucEventBuf || !prCmdInfo->pvInformationBuffer) {
if (prCmdInfo->fgIsOid) {
kalOidComplete(prAdapter->prGlueInfo,
prCmdInfo->fgSetQuery,
0,
WLAN_STATUS_FAILURE);
}
+
+ if (!pucEventBuf)
+ DBGLOG(NIC, WARN, "NULL pucEventBuf!\n");
+
+ if (!prCmdInfo->pvInformationBuffer)
+ DBGLOG(NIC, WARN, "NULL pvInformationBuffer!\n");
+
return;
}
diff --git a/os/linux/gl_proc.c b/os/linux/gl_proc.c
index 4bba952..7afb708 100644
--- a/os/linux/gl_proc.c
+++ b/os/linux/gl_proc.c
@@ -730,8 +730,6 @@
case STREAM_MIMO:
kalStrnCpy(prefix, "mimo", sizeof(prefix));
break;
- default:
- break;
}
*pos += kalScnprintf(buf + *pos, TMP_SZ - *pos,
@@ -821,7 +819,7 @@
}
buffer = (char *) kalMemAlloc(buf_len, VIR_MEM_TYPE);
- if (!buf)
+ if (!buffer)
return -ENOMEM;
for (i = 0; i < STREAM_NUM; i++) {