static int __profile_init_wifi_profile(net_profile_info_t *profile_info)
{
- GSList *list = NULL;
GSList *interface_list = NULL;
+ const char *interface_name = NULL;
if (net_get_wifi_interface_list(NULL, &interface_list) != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Fail to get interface list");
return CONNECTION_ERROR_OPERATION_FAILED;
}
- for (list = interface_list; list; list = list->next) {
- const char *interface_name = list->data;
- g_strlcpy(profile_info->ProfileName, interface_name, NET_PROFILE_NAME_LEN_MAX);
- g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProfileName,
- interface_name, NET_PROFILE_NAME_LEN_MAX);
- break;
- }
-
- if (list == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Fail to get interface name");
- g_slist_free_full(interface_list, g_free);
- return CONNECTION_ERROR_INVALID_OPERATION;
- }
+ interface_name = interface_list->data;
+ g_strlcpy(profile_info->ProfileName, interface_name, NET_PROFILE_NAME_LEN_MAX);
+ g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProfileName,
+ interface_name, NET_PROFILE_NAME_LEN_MAX);
profile_info->profile_type = NET_DEVICE_WIFI;
profile_info->ProfileState = NET_STATE_TYPE_IDLE;