bugfix: correct return value.
This commit is contained in:
@@ -114,19 +114,19 @@ NODE_ENTRY* L2_AppendNode(NODE_LIST *list, uint8_t nodeId, L2_NODE_TYPE nodeType
|
||||
ASSERT(list != NULL);
|
||||
if(L2_isNodeInList(list, nodeId)){
|
||||
DBG_WARNING("Node [%d] already exist.\n", nodeId);
|
||||
return FAILURE;
|
||||
return NULL;
|
||||
}
|
||||
DBG_INFO("Link layer appending node [%d] to node list.\n", nodeId);
|
||||
NODE_ENTRY* nodeEntry = (NODE_ENTRY*) malloc(sizeof(NODE_ENTRY));
|
||||
if (nodeEntry == NULL) {
|
||||
DBG_ERROR("Failed to allocated memory for nodeEntry.\n");
|
||||
return ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
list_node_t* node = list_node_new(nodeEntry);
|
||||
if(node == NULL) {
|
||||
DBG_ERROR("Failed to allocated memory for list node.\n");
|
||||
free(nodeEntry);
|
||||
return ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
nodeEntry->nodeInfo.nodeId = nodeId;
|
||||
nodeEntry->nodeInfo.nodeType = (uint8_t)nodeType;
|
||||
@@ -138,7 +138,8 @@ NODE_ENTRY* L2_AppendNode(NODE_LIST *list, uint8_t nodeId, L2_NODE_TYPE nodeType
|
||||
nodeEntry->nodeInfo.speed.z = 0;
|
||||
nodeEntry->nodeInfo.beamNo = 0;
|
||||
nodeEntry->ttlCnt = 0;
|
||||
return SUCCESS;
|
||||
list_rpush(list, node);
|
||||
return nodeEntry;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user