提交 ffdcb5ac 编写于 作者: Z z00544210 提交者: public tcshversion

TicketNo:DTS2020062703140

Description:clean code
Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:No
PrivateCode(Yes/No):No

Change-Id: I0d183b3a222d6bc5008f10a8641d5d6b49ad5010
Reviewed-on: http://mgit-tm.rnd.huawei.com/9636364Tested-by: Npublic jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: Nfengyonghui 00506037 <fengyonghui@huawei.com>
Reviewed-by: Nliujunpeng 00275571 <liujunpeng@huawei.com>
上级 ac5f24b3
......@@ -44,6 +44,7 @@ static void WifiWpaHapdDeinit(void *priv);
void ServiceExitHandler(int sig)
{
(void)sig;
if (g_wifiDriverType == WIFI_IFTYPE_STATION) {
WifiWpaDeinit(g_wifiDriverData);
} else if (g_wifiDriverType == WIFI_IFTYPE_AP) {
......@@ -309,7 +310,7 @@ static void WifiWpaDeinit(void *priv)
os_free(drv);
g_wifiDriverData = NULL;
(void)ShutdownMessageRouter();
WpaMsgServiceDeinit();
wpa_printf(MSG_INFO, "WifiWpaDeinit done");
}
......@@ -374,6 +375,7 @@ static int32_t WifiWpaDeauthenticate(void *priv, const uint8_t *addr, int32_t re
int32_t ret;
WifiDriverData *drv = priv;
(void)addr;
if (priv == NULL) {
return -EFAIL;
}
......@@ -915,6 +917,7 @@ static struct wpa_scan_results *WifiWpaGetScanResults2(void *priv)
static void *WifiWpaInit2(void *ctx, const char *ifname, void *globalPriv)
{
(void)globalPriv;
return WifiWpaInit(ctx, ifname);
}
......@@ -1361,7 +1364,7 @@ static void WifiWpaHapdDeinit(void *priv)
os_free(drv);
g_wifiDriverData = NULL;
(void)ShutdownMessageRouter();
WpaMsgServiceDeinit();
wpa_printf(MSG_INFO, "WifiWpaHapdDeinit done");
}
......@@ -1494,6 +1497,9 @@ static int32_t WifiWpaSendAction(void *priv, uint32_t freq, uint32_t wait, const
WifiDriverData *drv = NULL;
int32_t ret;
(void)freq;
(void)wait;
(void)noCck;
if ((priv == NULL) || (data == NULL) || (dst == NULL) || (src == NULL)) {
return -EFAIL;
}
......
......@@ -36,6 +36,8 @@ int32_t WifiWpaEapolPacketSend(const char *ifname, const uint8_t *srcAddr, const
uint32_t cmd = WIFI_WPA_CMD_SEND_EAPOL;
int32_t ret;
(void)srcAddr;
(void)dstAddr;
if (ifname == NULL || buf == NULL) {
return -EFAIL;
}
......@@ -339,7 +341,7 @@ int32_t WifiWpaCmdGetOwnMac(const char *ifname, void *buf, uint32_t len)
if (ifname == NULL || buf == NULL) {
return -EFAIL;
}
(void)len;
DataBlock data = { 0 };
DataBlock reply = { 0 };
if (InitDefaultSizeDataBlock(&data)) {
......@@ -360,7 +362,9 @@ int32_t WifiWpaCmdGetOwnMac(const char *ifname, void *buf, uint32_t len)
DeinitDataBlock(&reply);
return -EFAIL;
}
os_memcpy(buf, replayData, replayDataSize);
if (memcpy_s(buf, len, replayData, replayDataSize) != EOK) {
wpa_printf(MSG_ERROR, "%s memcpy failed", __func__);
}
DeinitDataBlock(&reply);
return ret;
}
......@@ -389,7 +393,9 @@ int32_t WifiWpaCmdGetHwFeature(const char *ifname, WifiHwFeatureData *hwFeatureD
DeinitDataBlock(&reply);
return -EFAIL;
}
os_memcpy(hwFeatureData, respFeaturenData, dataSize);
if (memcpy_s(hwFeatureData, sizeof(WifiHwFeatureData), respFeaturenData, dataSize) != EOK) {
wpa_printf(MSG_ERROR, "%s memcpy failed", __func__);
}
DeinitDataBlock(&reply);
return SUCC;
}
......@@ -474,7 +480,7 @@ int32_t WifiWpaCmdSetMaxStaNum(const char *ifname, void *buf, uint32_t len)
if (ifname == NULL || buf == NULL) {
return -EFAIL;
}
(void)len;
return SUCC;
}
......
......@@ -339,7 +339,7 @@ static void WifiWpaEventDisconnectProcess(WifiDriverData *drv, const DataBlock *
static inline void WifiWpaDriverEventEapolRecvProcess(WifiDriverData *drv, const DataBlock *reqData)
{
wpa_printf(MSG_ERROR, "WifiWpaDriverEventEapolRecvProcess call");
wpa_printf(MSG_INFO, "WifiWpaDriverEventEapolRecvProcess call");
l2_packet_receive(drv->eapolSock, NULL);
}
......@@ -348,7 +348,7 @@ int32_t WifiWpaDriverEventProcess(const char *ifname, int32_t event, const DataB
WifiDriverData *drv = GetDrvData();
int32_t ret = SUCC;
if (ifname == NULL || drv == NULL) {
if (ifname == NULL || drv == NULL || reqData == NULL) {
return -EFAIL;
}
wpa_printf(MSG_INFO, "WifiWpaDriverEventProcess event=%d", event);
......
......@@ -32,6 +32,12 @@ ErrorCode WifiWpaEventMsg(const RequestContext *context, const DataBlock *reqDat
char *ifname = NULL;
uint32_t ifnameLen = 0;
(void)context;
(void)rspData;
if (reqData == NULL) {
HDF_LOGE("%s: params is NULL", __func__);
return ME_ERROR_PARA_WRONG;
}
if (PopNextStringSegment(reqData, &ifname, &ifnameLen) != ME_SUCCESS) {
HDF_LOGE("%s: fail to get ifname", __func__);
return ME_ERROR_PARA_WRONG;
......@@ -54,9 +60,9 @@ ServiceDefEnd;
Service *g_wpaService;
int16_t WpaMsgServiceInit(void)
int32_t WpaMsgServiceInit(void)
{
int rc;
int32_t rc;
rc = StartMessageRouter(MESSAGE_NODE_LOCAL | MESSAGE_NODE_REMOTE_USERSPACE_CLIENT);
if (rc != 0) {
......@@ -76,6 +82,13 @@ int16_t WpaMsgServiceInit(void)
return HDF_SUCCESS;
}
void WpaMsgServiceDeinit(void)
{
if (ShutdownMessageRouter() != HDF_SUCCESS) {
HDF_LOGE("%s failed.", __func__);
}
}
int32_t WifiWpaCmdSyncSend(const uint32_t cmd, void *buf, uint32_t len, DataBlock *respData)
{
int32_t ret = HDF_FAILURE;
......@@ -87,13 +100,17 @@ int32_t WifiWpaCmdSyncSend(const uint32_t cmd, void *buf, uint32_t len, DataBloc
if (g_wpaService != NULL && g_wpaService->SendSyncMessage != NULL) {
ret = g_wpaService->SendSyncMessage(g_wpaService, WAL_MSG_SERVICE_ID, cmd, buf, len, respData);
}
HDF_LOGE("WifiWpaCmdSyncSend info cmd=%d, ret=%d", cmd, ret);
HDF_LOGI("WifiWpaCmdSyncSend info cmd=%d, ret=%d", cmd, ret);
return ret;
}
int32_t WifiWpaCmdBlockSyncSend(const uint32_t cmd, DataBlock *data, DataBlock *respData)
{
if (data == NULL) {
HDF_LOGE("%s params is NULL", __func__);
return HDF_FAILURE;
}
return WifiWpaCmdSyncSend(cmd, data->data, data->size, respData);
}
......
......@@ -30,7 +30,8 @@ extern "C" {
#define WIFI_WPA_EVENT_MSG 0
int16_t WpaMsgServiceInit(void);
int32_t WpaMsgServiceInit(void);
void WpaMsgServiceDeinit(void);
int32_t WifiWpaCmdSyncSend(const uint32_t cmd, void *buf, uint32_t len, DataBlock *respData);
int32_t WifiWpaCmdBlockSyncSend(const uint32_t cmd, DataBlock *data, DataBlock *respData);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册