From: saerome kim Date: Thu, 6 Jul 2017 23:42:11 +0000 (+0900) Subject: Increase line coverage X-Git-Tag: submit/tizen/20170828.225740~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db73bebdb321d46d8c9f61aebf41cf7b7d00c351;p=platform%2Fcore%2Fapi%2Fwifi-mesh.git Increase line coverage Signed-off-by: saerome kim --- diff --git a/src/wifi-mesh-dbus.c b/src/wifi-mesh-dbus.c index f3fb6af..6b47305 100644 --- a/src/wifi-mesh-dbus.c +++ b/src/wifi-mesh-dbus.c @@ -72,6 +72,7 @@ static GDBusProxy *_proxy_get_mesh_service(struct mesh_handle *handle) static void _dbus_name_owner_notify(GObject *object, GParamSpec *pspec, gpointer *user_data) { + /* LCOV_EXCL_START */ GDBusProxy *proxy = G_DBUS_PROXY(object); gchar *name_owner = g_dbus_proxy_get_name_owner(proxy); wifi_mesh_h handle = (wifi_mesh_h)user_data; @@ -79,9 +80,10 @@ static void _dbus_name_owner_notify(GObject *object, GParamSpec *pspec, LOGD("Name owner notify [%s]", name_owner); if (NULL == name_owner) - _wifi_mesh_close_gdbus_call(handle); + _wifi_mesh_close_gdbus_call(handle); //LCOV_EXCL_LINE g_free(name_owner); + /* LCOV_EXCL_STOP */ } static int _wifi_mesh_create_gdbus_call(wifi_mesh_h handle) @@ -91,27 +93,31 @@ static int _wifi_mesh_create_gdbus_call(wifi_mesh_h handle) struct mesh_handle *h = handle; if (NULL == h) - return WIFI_MESH_ERROR_INVALID_PARAMETER; + return WIFI_MESH_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE if (h->dbus_connection != NULL) - return WIFI_MESH_ERROR_ALREADY_IN_PROGRESS; + return WIFI_MESH_ERROR_ALREADY_IN_PROGRESS; //LCOV_EXCL_LINE h->dbus_connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (h->dbus_connection == NULL) { + /* LCOV_EXCL_START */ if (error != NULL) { LOGE("Failed to connect to the D-BUS daemon [%s]", error->message); g_error_free(error); } return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } id = g_signal_connect(h->dbus_connection, "notify::g-name-owner", G_CALLBACK(_dbus_name_owner_notify), h); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_signal_connect() Fail"); g_object_unref(h->dbus_connection); h->dbus_connection = NULL; return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return WIFI_MESH_ERROR_NONE; @@ -131,34 +137,36 @@ static int _wifi_mesh_close_gdbus_call(wifi_mesh_h handle) static GList *g_networks = { 0, }; static void _wifi_mesh_free_network(gpointer data) { + /* LCOV_EXCL_START */ struct mesh_network_s *network = data; g_free(network); network = NULL; + /* LCOV_EXCL_STOP */ } static void _mesh_remove_networks() { if (g_networks) - g_list_free_full(g_networks, _wifi_mesh_free_network); + g_list_free_full(g_networks, _wifi_mesh_free_network); //LCOV_EXCL_LINE g_networks = NULL; } static void _wifi_mesh_append_network(gpointer data) { - g_networks = g_list_append(g_networks, data); + g_networks = g_list_append(g_networks, data); //LCOV_EXCL_LINE } static GList *g_peers = NULL; static void _wifi_mesh_remove_peers() { if (g_peers) - g_list_free(g_peers); + g_list_free(g_peers); //LCOV_EXCL_LINE g_peers = NULL; } static void _wifi_mesh_append_peer(gpointer data) { - g_peers = g_list_append(g_peers, data); + g_peers = g_list_append(g_peers, data); //LCOV_EXCL_LINE } int _wifi_mesh_get_scan_result(wifi_mesh_h handle) @@ -178,8 +186,19 @@ int _wifi_mesh_get_scan_result(wifi_mesh_h handle) /* Clear previous scan results */ _mesh_remove_networks(); - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_found_mesh_networks", NULL, @@ -190,6 +209,7 @@ int _wifi_mesh_get_scan_result(wifi_mesh_h handle) g_variant_get(variant, "(aa{sv}i)", &iter, &result); result = __convert_service_error_type(result); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { + /* LCOV_EXCL_START */ struct mesh_network_s *network_info = g_malloc0(sizeof(struct mesh_network_s)); while (g_variant_iter_loop(iter_row, "{sv}", &key, &val)) { @@ -220,13 +240,16 @@ int _wifi_mesh_get_scan_result(wifi_mesh_h handle) _wifi_mesh_append_network(network_info); g_variant_iter_free(iter_row); + /* LCOV_EXCL_STOP */ } g_variant_iter_free(iter); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -249,8 +272,19 @@ int _wifi_mesh_find_peers(wifi_mesh_h handle) /* Clear previous peer list */ _wifi_mesh_remove_peers(); - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_connected_peers", NULL, @@ -261,6 +295,7 @@ int _wifi_mesh_find_peers(wifi_mesh_h handle) g_variant_get(variant, "(aa{sv}i)", &iter, &result); result = __convert_service_error_type(result); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { + /* LCOV_EXCL_START */ struct mesh_peer_s *peer_info = g_malloc0(sizeof(struct mesh_peer_s)); while (g_variant_iter_loop(iter_row, "{sv}", &key, &val)) { @@ -273,13 +308,16 @@ int _wifi_mesh_find_peers(wifi_mesh_h handle) /* Last element */ _wifi_mesh_append_peer(peer_info); g_variant_iter_free(iter_row); + /* LCOV_EXCL_STOP */ } g_variant_iter_free(iter); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -289,10 +327,22 @@ static void _mesh_signal_handler(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) { + /* LCOV_EXCL_START */ mesh_handle_s *h = user_data; - RETM_IF(NULL == h, "user_data is null"); - RETM_IF(NULL == h->event_handler, "event_handler is null"); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("user_data is null"); + return; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->event_handler) { + /* LCOV_EXCL_START */ + LOGE("event_handler is null"); + return; + /* LCOV_EXCL_STOP */ + } LOGD("signal received = %s", signal_name); if (0 == g_strcmp0(signal_name, "wifi_mesh_enabled")) { @@ -302,7 +352,9 @@ static void _mesh_signal_handler(GDBusConnection *connection, g_variant_get(parameters, "(i)", &result); ev.data.wifi_mesh_enable = calloc(1, sizeof(wifi_mesh_enabled_event_s)); - RETM_IF(NULL == ev.data.wifi_mesh_enable, "Failed to memory allocation !"); + if (NULL == ev.data.wifi_mesh_enable) + LOGE("Failed to memory allocation !"); // LCOV_EXCL_LINE + ev.data.wifi_mesh_enable->result = __convert_service_error_type(result); h->event_handler(WIFI_MESH_EVENT_ENABLED, &ev); @@ -320,8 +372,8 @@ static void _mesh_signal_handler(GDBusConnection *connection, g_variant_get(parameters, "(ssiii)", &mesh_id, &bssid, &channel, &security, &state); ev.data.connection_state = calloc(1, sizeof(wifi_mesh_connection_state_event_s)); - RETM_IF(NULL == ev.data.connection_state, "Failed to memory allocation !"); - + if (NULL == ev.data.connection_state) + LOGE("Failed to memory allocation !"); // LCOV_EXCL_LINE g_snprintf(ev.data.connection_state->mesh_id, MAX_MESHID_LEN, "%s", mesh_id); g_snprintf(ev.data.connection_state->bssid, MAX_BSSID_LEN, "%s", bssid); ev.data.connection_state->channel = channel; @@ -334,7 +386,8 @@ static void _mesh_signal_handler(GDBusConnection *connection, char *bssid = NULL; wifi_mesh_event_data_s ev; ev.data.sta_info = calloc(1, sizeof(wifi_mesh_other_station_event_s)); - RETM_IF(NULL == ev.data.sta_info, "Failed to memory allocation !"); + if (NULL == ev.data.sta_info) + LOGE("Failed to memory allocation !"); // LCOV_EXCL_LINE g_variant_get(parameters, "(s)", &bssid); memcpy(ev.data.sta_info->bssid, bssid, MAX_BSSID_LEN); h->event_handler(WIFI_MESH_EVENT_STATION_JOIN, &ev); @@ -342,8 +395,10 @@ static void _mesh_signal_handler(GDBusConnection *connection, } else if (0 == g_strcmp0(signal_name, "sta_left")) { char *bssid = NULL; wifi_mesh_event_data_s ev; + ev.data.sta_info = calloc(1, sizeof(wifi_mesh_other_station_event_s)); - RETM_IF(NULL == ev.data.sta_info, "Failed to memory allocation !"); + if (NULL == ev.data.sta_info) + LOGE("Failed to memory allocation !"); // LCOV_EXCL_LINE g_variant_get(parameters, "(s)", &bssid); memcpy(ev.data.sta_info->bssid, bssid, MAX_BSSID_LEN); h->event_handler(WIFI_MESH_EVENT_STATION_LEFT, &ev); @@ -361,8 +416,10 @@ static void _mesh_subscribe_event(wifi_mesh_h handle) NULL, MESH_SERVER_NAME, "wifi_mesh_enabled", MESH_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_dbus_connection_signal_subscribe(wifi_mesh_enabled) Fail(%d)", errno); return; + /* LCOV_EXCL_STOP */ } h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id)); LOGD("subscribed for wifi_mesh_enabled signal %d", id); @@ -372,8 +429,10 @@ static void _mesh_subscribe_event(wifi_mesh_h handle) "scan_done", MESH_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_dbus_connection_signal_subscribe(scan_done) Fail(%d)", errno); return; + /* LCOV_EXCL_STOP */ } h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id)); LOGD("subscribed for scan_done signal %d", id); @@ -383,8 +442,10 @@ static void _mesh_subscribe_event(wifi_mesh_h handle) "connection_state", MESH_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_dbus_connection_signal_subscribe(connection_state) Fail(%d)", errno); return; + /* LCOV_EXCL_STOP */ } h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id)); LOGD("subscribed for connection_state signal %d", id); @@ -394,8 +455,10 @@ static void _mesh_subscribe_event(wifi_mesh_h handle) "sta_joined", MESH_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_dbus_connection_signal_subscribe(sta_joined) Fail(%d)", errno); return; + /* LCOV_EXCL_STOP */ } h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id)); LOGD("subscribed for sta_joined signal %d", id); @@ -405,8 +468,10 @@ static void _mesh_subscribe_event(wifi_mesh_h handle) "sta_left", MESH_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL); if (0 == id) { + /* LCOV_EXCL_START */ LOGE("g_dbus_connection_signal_subscribe(sta_left) Fail(%d)", errno); return; + /* LCOV_EXCL_STOP */ } h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id)); LOGD("subscribed for sta_left signal %d", id); @@ -425,7 +490,12 @@ static void _on_unsubscribe_ids(gpointer data, gpointer user_data) static void _mesh_unsubscribe_event(wifi_mesh_h handle) { struct mesh_handle *h = handle; - RET_IF(NULL == h); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return; + /* LCOV_EXCL_STOP */ + } g_list_foreach(h->dbus_sub_ids, _on_unsubscribe_ids, h); @@ -503,8 +573,8 @@ static void _mesh_free_mpath(gpointer data) static void _mesh_add_mpath(gpointer data) { - g_mpath.list = g_list_append(g_mpath.list, data); - g_mpath.count++; + g_mpath.list = g_list_append(g_mpath.list, data); // LCOV_EXCL_LINE + g_mpath.count++; // LCOV_EXCL_LINE } static void _mesh_remove_mpath() @@ -518,7 +588,9 @@ static void _mesh_remove_mpath() int _wifi_mesh_set_event_cb(wifi_mesh_h handle, wifi_mesh_event_cb event_handler) { struct mesh_handle *h = handle; + /* LCOV_EXCL_START */ RETV_IF(NULL == h, WIFI_MESH_ERROR_INVALID_PARAMETER); + /* LCOV_EXCL_STOP */ h->event_handler = event_handler; return WIFI_MESH_ERROR_NONE; } @@ -530,7 +602,19 @@ int _wifi_mesh_enable(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_connection_call_sync(h->dbus_connection, MESH_MANAGER_NAME, @@ -545,9 +629,11 @@ int _wifi_mesh_enable(wifi_mesh_h handle) LOGD("enabled status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -564,7 +650,19 @@ int _wifi_mesh_disable(wifi_mesh_h handle) _mesh_remove_networks(); _mesh_remove_mpath(); - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_connection_call_sync(h->dbus_connection, MESH_MANAGER_NAME, @@ -579,9 +677,11 @@ int _wifi_mesh_disable(wifi_mesh_h handle) LOGD("Disabled status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } h->event_handler = NULL; @@ -595,8 +695,19 @@ int _wifi_mesh_scan(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "scan", NULL, @@ -608,9 +719,11 @@ int _wifi_mesh_scan(wifi_mesh_h handle) LOGD("scan status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -623,8 +736,19 @@ int _wifi_mesh_specific_scan(wifi_mesh_h handle, const char* ssid, int channel) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "specific_scan", g_variant_new("(si)", ssid, channel), @@ -636,9 +760,11 @@ int _wifi_mesh_specific_scan(wifi_mesh_h handle, const char* ssid, int channel) LOGD("specific_scan status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -651,8 +777,19 @@ int _wifi_mesh_cancel_scan(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "cancel_scan", NULL, @@ -664,9 +801,11 @@ int _wifi_mesh_cancel_scan(wifi_mesh_h handle) LOGD("cancle_scan status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -680,15 +819,32 @@ int _mesh_foreach_found_mesh_network(wifi_mesh_h handle, struct mesh_network_s *data = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == cb, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } + if (NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } if (0 >= g_list_length(g_networks)) { LOGD("No scan result"); return WIFI_MESH_ERROR_NONE; } + /* LCOV_EXCL_START */ /* Get a first item */ i = 0; iter = g_list_first(g_networks); @@ -696,12 +852,13 @@ int _mesh_foreach_found_mesh_network(wifi_mesh_h handle, while (NULL != iter) { data = iter->data; if (data) - LOGE("data is null"); + LOGE("data is null"); //LCOV_EXCL_LINE cb(data, user_data); /* Next item */ iter = g_list_next(iter); i++; } + /* LCOV_EXCL_STOP */ return WIFI_MESH_ERROR_NONE; } @@ -714,15 +871,35 @@ int _wifi_mesh_foreach_connected_peers(wifi_mesh_h handle, struct mesh_network_s *data = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == cb, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } + + if (NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } if (0 >= g_list_length(g_peers)) { + /* LCOV_EXCL_START */ LOGD("No peer data"); return WIFI_MESH_ERROR_NONE; + /* LCOV_EXCL_STOP */ } + /* LCOV_EXCL_START */ /* Get a first item */ i = 0; iter = g_list_first(g_peers); @@ -736,6 +913,7 @@ int _wifi_mesh_foreach_connected_peers(wifi_mesh_h handle, iter = g_list_next(iter); i++; } + /* LCOV_EXCL_STOP */ return WIFI_MESH_ERROR_NONE; } @@ -747,8 +925,19 @@ int _wifi_mesh_enable_mesh(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "enable_mesh", NULL, @@ -760,9 +949,11 @@ int _wifi_mesh_enable_mesh(wifi_mesh_h handle) LOGD("enable_mesh status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -775,8 +966,19 @@ int _wifi_mesh_disable_mesh(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "disable_mesh", NULL, @@ -788,9 +990,11 @@ int _wifi_mesh_disable_mesh(wifi_mesh_h handle) LOGD("disable_mesh status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -805,8 +1009,19 @@ int _wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined) gboolean state; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "is_joined", NULL, @@ -819,9 +1034,11 @@ int _wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined) result = __convert_service_error_type(result); *is_joined = ((state) ? true : false); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -836,10 +1053,26 @@ int _mesh_get_joined_mesh_network(wifi_mesh_h handle, wifi_mesh_network_h* _netw GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _network, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } + if (NULL == _network) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_joined_mesh_network", NULL, G_DBUS_CALL_FLAGS_NONE, @@ -890,9 +1123,11 @@ int _mesh_get_joined_mesh_network(wifi_mesh_h handle, wifi_mesh_network_h* _netw *_network = &g_joined_network; } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -905,8 +1140,19 @@ int _wifi_mesh_set_gate(wifi_mesh_h handle, bool gate_announce, int hwmp_root_mo GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "set_gate", g_variant_new("(bqq)", gate_announce, hwmp_root_mode, stp), @@ -918,9 +1164,11 @@ int _wifi_mesh_set_gate(wifi_mesh_h handle, bool gate_announce, int hwmp_root_mo LOGD("set_gate status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -933,8 +1181,19 @@ int _wifi_mesh_unset_gate(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "unset_gate", NULL, @@ -946,9 +1205,11 @@ int _wifi_mesh_unset_gate(wifi_mesh_h handle) LOGD("unset_gate status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -964,8 +1225,19 @@ int _wifi_mesh_set_softap(wifi_mesh_h handle, const char* ssid, GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "set_softap", g_variant_new("(sssiiii)", ssid, key, mode, @@ -978,9 +1250,11 @@ int _wifi_mesh_set_softap(wifi_mesh_h handle, const char* ssid, LOGD("set_softap status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -993,8 +1267,19 @@ int _wifi_mesh_enable_softap(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "enable_softap", NULL, @@ -1006,9 +1291,11 @@ int _wifi_mesh_enable_softap(wifi_mesh_h handle) LOGD("enable_softap status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1021,8 +1308,19 @@ int _wifi_mesh_disable_softap(wifi_mesh_h handle) GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "disable_softap", NULL, @@ -1034,9 +1332,11 @@ int _wifi_mesh_disable_softap(wifi_mesh_h handle) LOGD("disable_softap status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1050,8 +1350,19 @@ int _mesh_create_network(wifi_mesh_h handle, wifi_mesh_network_h _network) struct mesh_handle *h = handle; struct mesh_network_s *n = _network; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "create_mesh_network", g_variant_new("(sii)", n->meshid, n->channel, n->security), @@ -1063,9 +1374,11 @@ int _mesh_create_network(wifi_mesh_h handle, wifi_mesh_network_h _network) LOGD("create_network status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1079,8 +1392,19 @@ int _mesh_connect_network(wifi_mesh_h handle, wifi_mesh_network_h _network) struct mesh_handle *h = handle; struct mesh_network_s *n = _network; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "connect_mesh_network", g_variant_new("(siis)", n->meshid, n->channel, n->security, n->passphrase), @@ -1092,9 +1416,11 @@ int _mesh_connect_network(wifi_mesh_h handle, wifi_mesh_network_h _network) LOGD("connect network status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1108,8 +1434,19 @@ int _mesh_disconnect_network(wifi_mesh_h handle, wifi_mesh_network_h _network) struct mesh_handle *h = handle; struct mesh_network_s *n = _network; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "disconnect_mesh_network", g_variant_new("(sii)", n->meshid, n->channel, n->security), @@ -1121,9 +1458,11 @@ int _mesh_disconnect_network(wifi_mesh_h handle, wifi_mesh_network_h _network) LOGD("disconnect network status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1137,8 +1476,19 @@ int _mesh_forget_network(wifi_mesh_h handle, wifi_mesh_network_h _network) struct mesh_handle *h = handle; struct mesh_network_s *n = _network; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } LOGD("mesid=%s channel=%d security=%d", n->meshid, n->channel, n->security); @@ -1152,9 +1502,11 @@ int _mesh_forget_network(wifi_mesh_h handle, wifi_mesh_network_h _network) LOGD("forget_network status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1174,8 +1526,19 @@ int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb GVariant *val; gsize len = 0; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_station_info", NULL, @@ -1188,6 +1551,7 @@ int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { struct mesh_station_info_s station; memset(&station, 0, sizeof(struct mesh_station_info_s)); + /* LCOV_EXCL_START */ while (g_variant_iter_loop(iter_row, "{sv}", &key, &val)) { if (strcasecmp(key, "bssid") == 0) { const char *buf = g_variant_get_string(val, &len); @@ -1291,14 +1655,17 @@ int _wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_station_cb } } g_variant_iter_free(iter_row); + /* LCOV_EXCL_STOP */ } g_variant_iter_free(iter); LOGD("get_saved_mesh_networks status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1318,8 +1685,19 @@ int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void * GVariant *val; gsize len = 0; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "get_mpath_info", NULL, @@ -1332,8 +1710,8 @@ int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void * /* handle station list here */ g_variant_get(variant, "(aa{sv}i)", &iter, &result); - LOGE("1"); while (g_variant_iter_next(iter, "a{sv}", &iter_row)) { + /* LCOV_EXCL_START */ struct mesh_mpath_dump_s *mpath = g_malloc0(sizeof(struct mesh_mpath_dump_s)); while (g_variant_iter_loop(iter_row, "{sv}", &key, &val)) { if (strcasecmp(key, "DEST_ADDR") == 0) { @@ -1378,14 +1756,17 @@ int _wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb cb, void * } } g_variant_iter_free(iter_row); + /* LCOV_EXCL_STOP */ } g_variant_iter_free(iter); LOGD("get_saved_mesh_networks status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; @@ -1398,8 +1779,19 @@ int _wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char * GError *error = NULL; struct mesh_handle *h = handle; - RETV_IF(NULL == h->dbus_connection, WIFI_MESH_ERROR_IO_ERROR); - RETV_IF(NULL == _gproxy_mesh_service, WIFI_MESH_ERROR_IO_ERROR); + if (NULL == h) { + /* LCOV_EXCL_START */ + LOGE("Invaild parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } + + if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) { + /* LCOV_EXCL_START */ + LOGE("I/O error"); + return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ + } variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "set_interfaces", g_variant_new("(sss)", mesh, gate, softap), @@ -1411,9 +1803,11 @@ int _wifi_mesh_set_interfaces(wifi_mesh_h handle, const char *mesh, const char * LOGD("set_interfaces status 0x%x", result); result = __convert_service_error_type(result); } else if (error) { + /* LCOV_EXCL_START */ LOGE("Failed DBus call [%s]", error->message); g_error_free(error); return WIFI_MESH_ERROR_IO_ERROR; + /* LCOV_EXCL_STOP */ } return result; diff --git a/src/wifi-mesh-internal.c b/src/wifi-mesh-internal.c index 80ae01d..b5fea27 100644 --- a/src/wifi-mesh-internal.c +++ b/src/wifi-mesh-internal.c @@ -29,7 +29,7 @@ EXPORT_API int wifi_mesh_network_get_data_rate(wifi_mesh_network_h network, int CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || data_rate == NULL) { + if (NULL == network || NULL == data_rate) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -47,7 +47,7 @@ EXPORT_API int wifi_mesh_network_set_data_rate(wifi_mesh_network_h network, int CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -64,7 +64,12 @@ EXPORT_API int wifi_mesh_cancel_scan(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_cancel_scan(handle); return rv; @@ -76,7 +81,12 @@ EXPORT_API int wifi_mesh_set_gate(wifi_mesh_h handle, int gate_announce, int hwm int _stp = stp ? 1 : 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_set_gate(handle, gate_announce, hwmp_root_mode, _stp); return rv; @@ -87,8 +97,12 @@ EXPORT_API int wifi_mesh_unset_gate(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_unset_gate(handle); return rv; } @@ -98,7 +112,12 @@ EXPORT_API int wifi_mesh_get_stations_info(wifi_mesh_h handle, wifi_mesh_found_s int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_get_stations_info(handle, cb, user_data); return rv; @@ -109,7 +128,12 @@ EXPORT_API int wifi_mesh_get_mpath_info(wifi_mesh_h handle, mesh_found_mpath_cb int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_get_mpath_info(handle, cb, user_data); return rv; @@ -121,8 +145,12 @@ EXPORT_API int wifi_mesh_set_interfaces(wifi_mesh_h handle, int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == mesh, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == mesh) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_set_interfaces(handle, mesh, gate, softap); return rv; diff --git a/src/wifi-mesh.c b/src/wifi-mesh.c index 17dc91f..70ec7a8 100644 --- a/src/wifi-mesh.c +++ b/src/wifi-mesh.c @@ -32,7 +32,7 @@ EXPORT_API int wifi_mesh_network_new(wifi_mesh_network_h* network) CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -94,7 +94,7 @@ EXPORT_API int wifi_mesh_network_new_with(wifi_mesh_network_h* network, const ch CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -140,7 +140,7 @@ EXPORT_API int wifi_mesh_network_get_meshid(wifi_mesh_network_h network, char ** CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || meshid == NULL) { + if (NULL == network || meshid == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -158,7 +158,7 @@ EXPORT_API int wifi_mesh_network_set_meshid(wifi_mesh_network_h network, const c CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || meshid == NULL) { + if (NULL == network || meshid == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -176,7 +176,7 @@ EXPORT_API int wifi_mesh_network_get_bssid(wifi_mesh_network_h network, char **b CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || bssid == NULL) { + if (NULL == network || bssid == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -194,7 +194,7 @@ EXPORT_API int wifi_mesh_network_set_bssid(wifi_mesh_network_h network, const ch CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || bssid == NULL) { + if (NULL == network || bssid == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -212,7 +212,7 @@ EXPORT_API int wifi_mesh_network_get_channel(wifi_mesh_network_h network, int *c CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || channel == NULL) { + if (NULL == network || channel == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -230,7 +230,7 @@ EXPORT_API int wifi_mesh_network_set_channel(wifi_mesh_network_h network, int ch CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -248,7 +248,7 @@ EXPORT_API int wifi_mesh_network_get_rssi(wifi_mesh_network_h network, int *rssi CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || rssi == NULL) { + if (NULL == network || rssi == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -266,7 +266,7 @@ EXPORT_API int wifi_mesh_network_set_rssi(wifi_mesh_network_h network, int rssi) CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -284,7 +284,7 @@ EXPORT_API int wifi_mesh_network_get_security(wifi_mesh_network_h network, wifi_ CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || security == NULL) { + if (NULL == network || security == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -302,7 +302,7 @@ EXPORT_API int wifi_mesh_network_set_security(wifi_mesh_network_h network, wifi_ CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -320,7 +320,7 @@ EXPORT_API int wifi_mesh_network_set_passphrase(wifi_mesh_network_h network, con CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL) { + if (NULL == network) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -342,7 +342,7 @@ EXPORT_API int wifi_mesh_network_get_connection_state(wifi_mesh_network_h networ CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (network == NULL || state == NULL) { + if (NULL == network || state == NULL) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -379,7 +379,7 @@ EXPORT_API int wifi_mesh_initialize(wifi_mesh_h *mesh) CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - if (mesh == NULL) { + if (NULL == mesh) { /* LCOV_EXCL_START */ LOGE("Invalid parameter"); return WIFI_MESH_ERROR_INVALID_PARAMETER; @@ -392,14 +392,16 @@ EXPORT_API int wifi_mesh_initialize(wifi_mesh_h *mesh) handle = g_new0(struct mesh_handle, 1); if (NULL == handle) { + /* LCOV_EXCL_START */ LOGE("Failed to create handle"); return WIFI_MESH_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ } *mesh = handle; rv = _mesh_dbus_start(*mesh); if (rv != WIFI_MESH_ERROR_NONE) - LOGD("D-Bus init: (0x%X)", rv); + LOGD("D-Bus init: (0x%X)", rv); //LCOV_EXCL_LINE return WIFI_MESH_ERROR_NONE; } @@ -421,7 +423,12 @@ EXPORT_API int wifi_mesh_set_event_cb(wifi_mesh_h handle, wifi_mesh_event_cb eve int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_set_event_cb(handle, event_handler); return rv; @@ -432,7 +439,12 @@ EXPORT_API int wifi_mesh_enable(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_enable(handle); return rv; @@ -443,7 +455,12 @@ EXPORT_API int wifi_mesh_disable(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_disable(handle); return rv; @@ -454,7 +471,12 @@ EXPORT_API int wifi_mesh_scan(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_scan(handle); return rv; @@ -465,8 +487,12 @@ EXPORT_API int wifi_mesh_specific_scan(wifi_mesh_h handle, const char* ssid, int int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == ssid, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || ssid == NULL) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_specific_scan(handle, ssid, channel); return rv; @@ -478,8 +504,12 @@ EXPORT_API int wifi_mesh_foreach_found_network(wifi_mesh_h handle, int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == cb, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_get_scan_result(handle); if (WIFI_MESH_ERROR_NONE != rv) @@ -495,8 +525,12 @@ EXPORT_API int wifi_mesh_foreach_connected_peers(wifi_mesh_h handle, int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == cb, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == cb) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_find_peers(handle); if (WIFI_MESH_ERROR_NONE != rv) @@ -511,8 +545,12 @@ EXPORT_API int wifi_mesh_start(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_enable_mesh(handle); return rv; } @@ -522,7 +560,12 @@ EXPORT_API int wifi_mesh_stop(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_disable_mesh(handle); return rv; @@ -533,7 +576,12 @@ EXPORT_API int wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || is_joined == NULL) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_is_joined(handle, is_joined); return rv; @@ -544,7 +592,12 @@ EXPORT_API int wifi_mesh_get_joined_network(wifi_mesh_h handle, wifi_mesh_networ int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == network) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _mesh_get_joined_mesh_network(handle, network); return rv; @@ -558,9 +611,12 @@ EXPORT_API int wifi_mesh_set_softap(wifi_mesh_h handle, const char* ssid, char buf[32] = {0,}; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == ssid, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || ssid == NULL || key == NULL) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } if (channel <= 13) memcpy(buf, "g", strlen("g")); @@ -577,7 +633,12 @@ EXPORT_API int wifi_mesh_enable_softap(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_enable_softap(handle); return rv; @@ -588,7 +649,12 @@ EXPORT_API int wifi_mesh_disable_softap(wifi_mesh_h handle) int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _wifi_mesh_disable_softap(handle); return rv; @@ -599,8 +665,12 @@ EXPORT_API int wifi_mesh_create_network(wifi_mesh_h handle, wifi_mesh_network_h int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == network, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == network) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _mesh_create_network(handle, network); return rv; @@ -611,8 +681,12 @@ EXPORT_API int wifi_mesh_connect_network(wifi_mesh_h handle, wifi_mesh_network_h int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == network, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == network) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _mesh_connect_network(handle, network); return rv; @@ -623,8 +697,12 @@ EXPORT_API int wifi_mesh_disconnect_network(wifi_mesh_h handle, wifi_mesh_networ int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == network, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == network) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _mesh_disconnect_network(handle, network); return rv; @@ -635,8 +713,12 @@ EXPORT_API int wifi_mesh_forget_network(wifi_mesh_h handle, wifi_mesh_network_h int rv = 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); - RETV_IF(NULL == handle, WIFI_MESH_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == network, WIFI_MESH_ERROR_INVALID_PARAMETER); + if (NULL == handle || NULL == network) { + /* LCOV_EXCL_START */ + LOGE("Invalid parameter"); + return WIFI_MESH_ERROR_INVALID_PARAMETER; + /* LCOV_EXCL_STOP */ + } rv = _mesh_forget_network(handle, network); return rv;