Add gtest for line coverage
[platform/core/api/tethering.git] / src / tethering.c
index 0a132a7..bf4551c 100755 (executable)
@@ -131,7 +131,7 @@ static int retry = 0;
 static void __send_dbus_signal(GDBusConnection *conn, const char *signal_name, const char *arg)
 {
        if (conn == NULL || signal_name == NULL)
-               return; //LCOV_EXCL_LINE
+               return;
 
        GVariant *message = NULL;
        GError *error = NULL;
@@ -142,8 +142,8 @@ static void __send_dbus_signal(GDBusConnection *conn, const char *signal_name, c
        g_dbus_connection_emit_signal(conn, NULL, TETHERING_SERVICE_OBJECT_PATH,
                                        TETHERING_SERVICE_INTERFACE, signal_name, message, &error);
        if (error) {
-               ERR("g_dbus_connection_emit_signal is failed because  %s\n", error->message); //LCOV_EXCL_LINE
-               g_error_free(error); //LCOV_EXCL_LINE
+               ERR("g_dbus_connection_emit_signal is failed because  %s\n", error->message);
+               g_error_free(error);
        }
 }
 
@@ -164,12 +164,12 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_
                        security_type != TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK &&
                        security_type != TETHERING_WIFI_SECURITY_TYPE_WPS &&
                        security_type != TETHERING_WIFI_SECURITY_TYPE_SAE) {
-               ERR("Invalid param\n"); //LCOV_EXCL_LINE
+               ERR("Invalid param\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY, security_type) < 0) {
-               ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
+               ERR("vconf_set_int is failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -179,13 +179,13 @@ static tethering_error_e __set_security_type(const tethering_wifi_security_type_
 static tethering_error_e __get_security_type(tethering_wifi_security_type_e *security_type)
 {
        if (security_type == NULL) {
-               ERR("Invalid param\n"); //LCOV_EXCL_LINE
+               ERR("Invalid param\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY,
                                (int *)security_type) < 0) {
-               ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
+               ERR("vconf_get_int is failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -216,7 +216,7 @@ static bool __get_ssid_from_vconf(const char *path, char *ssid, unsigned int siz
 static tethering_error_e __set_visible(const bool visible)
 {
        if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, visible ? 0 : 1) < 0) {
-               ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
+               ERR("vconf_set_int is failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -226,14 +226,14 @@ static tethering_error_e __set_visible(const bool visible)
 static tethering_error_e __get_visible(bool *visible)
 {
        if (visible == NULL) {
-               ERR("Invalid param\n"); //LCOV_EXCL_LINE
+               ERR("Invalid param\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
        int hide = 0;
 
        if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, &hide) < 0) {
-               ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
+               ERR("vconf_get_int is failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -271,11 +271,9 @@ static tethering_error_e __get_error(int agent_error)
                err = TETHERING_ERROR_NONE;
                break;
 
-       //LCOV_EXCL_START
        case MOBILE_AP_ERROR_RESOURCE:
                err = TETHERING_ERROR_OUT_OF_MEMORY;
                break;
-       //LCOV_EXCL_STOP
 
        case MOBILE_AP_ERROR_INTERNAL:
                err = TETHERING_ERROR_OPERATION_FAILED;
@@ -285,7 +283,6 @@ static tethering_error_e __get_error(int agent_error)
                err = TETHERING_ERROR_INVALID_PARAMETER;
                break;
 
-       //LCOV_EXCL_START
        case MOBILE_AP_ERROR_ALREADY_ENABLED:
                err = TETHERING_ERROR_OPERATION_FAILED;
                break;
@@ -317,7 +314,6 @@ static tethering_error_e __get_error(int agent_error)
        case MOBILE_AP_ERROR_PERMISSION_DENIED:
                err = TETHERING_ERROR_PERMISSION_DENIED;
                break;
-       //LCOV_EXCL_STOP
        default:
                ERR("Not defined error : %d\n", agent_error);
                err = TETHERING_ERROR_OPERATION_FAILED;
@@ -327,7 +323,6 @@ static tethering_error_e __get_error(int agent_error)
        return err;
 }
 
-//LCOV_EXCL_START
 static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
@@ -421,7 +416,6 @@ static void __handle_net_closed(GDBusConnection *connection, const gchar *sender
 
        DBG("-\n");
 }
-//LCOV_EXCL_STOP
 
 static void __handle_wifi_tether_on(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
@@ -477,7 +471,6 @@ static void __handle_wifi_tether_off(GDBusConnection *connection, const gchar *s
        DBG("-\n");
 }
 
-//LCOV_EXCL_START
 static void __handle_usb_tether_on(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                        GVariant *parameters, gpointer user_data)
@@ -529,7 +522,6 @@ static void __handle_usb_tether_off(GDBusConnection *connection, const gchar *se
        g_free(buf);
        DBG("-\n");
 }
-//LCOV_EXCL_STOP
 
 static void __handle_bt_tether_on(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
@@ -585,7 +577,6 @@ static void __handle_bt_tether_off(GDBusConnection *connection, const gchar *sen
        DBG("-\n");
 }
 
-//LCOV_EXCL_START
 static void __handle_no_data_timeout(GDBusConnection *connection, const gchar *sender_name,
                        const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                        GVariant *parameters, gpointer user_data)
@@ -660,7 +651,6 @@ static void __handle_flight_mode(GDBusConnection *connection, const gchar *sende
        }
        DBG("-\n");
 }
-//LCOV_EXCL_STOP
 
 static void __handle_security_type_changed(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
@@ -692,7 +682,7 @@ static void __handle_security_type_changed(GDBusConnection *connection, const gc
        else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_SAE_STR) == 0)
                security_type = TETHERING_WIFI_SECURITY_TYPE_SAE;
        else {
-               SERR("Unknown type : %s\n", buf); //LCOV_EXCL_LINE
+               SERR("Unknown type : %s\n", buf);
                g_free(buf);
                return;
        }
@@ -706,7 +696,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
 {
-       DBG("+\n"); //LCOV_EXCL_LINE
+       DBG("+\n");
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        __tethering_h *th = (__tethering_h *)user_data;
@@ -718,7 +708,7 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
 
        scb = th->ssid_visibility_changed_cb;
        if (scb == NULL) {
-               DBG("-\n"); //LCOV_EXCL_LINE
+               DBG("-\n");
                return;
        }
        g_variant_get(parameters, "(s)", &buf);
@@ -728,14 +718,14 @@ static void __handle_ssid_visibility_changed(GDBusConnection *connection, const
 
        scb(visible, data);
        g_free(buf);
-       DBG("-\n"); //LCOV_EXCL_LINE
+       DBG("-\n");
 }
 
 static void __handle_passphrase_changed(GDBusConnection *connection, const gchar *sender_name,
                const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
                GVariant *parameters, gpointer user_data)
 {
-       DBG("+\n"); //LCOV_EXCL_LINE
+       DBG("+\n");
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        __tethering_h *th = (__tethering_h *)user_data;
@@ -750,13 +740,13 @@ static void __handle_passphrase_changed(GDBusConnection *connection, const gchar
        data = th->passphrase_user_data;
 
        pcb(data);
-       DBG("-\n"); //LCOV_EXCL_LINE
+       DBG("-\n");
 }
 
 static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       INFO("+\n"); //LCOV_EXCL_LINE
+       INFO("+\n");
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
@@ -772,7 +762,6 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               //LCOV_EXCL_START
                ERR("DBus error [%s]\n", g_error->message);
                if (g_error->code == G_DBUS_ERROR_NO_REPLY &&
                                ++retry < TETHERING_ERROR_RECOVERY_MAX) {
@@ -784,14 +773,13 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                else
                        error = TETHERING_ERROR_OPERATION_FAILED;
                g_error_free(g_error);
-               //LCOV_EXCL_STOP
        } else {
                g_variant_get(g_var, "(u)", &info);
                error = __get_error(info);
        }
        retry = 0;
 
-       INFO("cfm event : wifi tethering enable info : %d\n", error); //LCOV_EXCL_LINE
+       INFO("cfm event : wifi tethering enable info : %d\n", error);
 
        sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id = g_dbus_connection_signal_subscribe(th->client_bus,
                        NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_TETHER_ON].name,
@@ -799,18 +787,18 @@ static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL);
 
        if (!ecb) {
-               INFO("-\n"); //LCOV_EXCL_LINE
+               INFO("-\n");
                return;
        }
        ecb(error, TETHERING_TYPE_WIFI, true, data);
        g_variant_unref(g_var);
-       INFO("-\n"); //LCOV_EXCL_LINE
+       INFO("-\n");
 }
 
 static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       DBG("+\n"); //LCOV_EXCL_LINE
+       DBG("+\n");
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
        GVariant *g_var;
@@ -826,7 +814,6 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               //LCOV_EXCL_START
                ERR("DBus error [%s]\n", g_error->message);
                if (g_error->code == G_DBUS_ERROR_NO_REPLY &&
                                ++retry < TETHERING_ERROR_RECOVERY_MAX) {
@@ -840,7 +827,6 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                else
                        error = TETHERING_ERROR_OPERATION_FAILED;
                g_error_free(g_error);
-               //LCOV_EXCL_STOP
        } else {
                g_variant_get(g_var, "(u)", &info);
                g_variant_unref(g_var);
@@ -854,7 +840,7 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        sigs[E_SIGNAL_BT_TETHER_ON].cb, (gpointer)th, NULL);
 
        if (!ecb) {
-               DBG("-\n"); //LCOV_EXCL_LINE
+               DBG("-\n");
                return;
        }
 
@@ -862,7 +848,6 @@ static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        DBG("-\n");
 }
 
-//LCOV_EXCL_START
 static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                                        gpointer user_data)
 {
@@ -963,12 +948,11 @@ static void __p2p_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        ecb(error, TETHERING_TYPE_P2P, true, data);
        DBG("-\n");
 }
-//LCOV_EXCL_STOP
 
 static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                gpointer user_data)
 {
-       INFO("+\n"); //LCOV_EXCL_LINE
+       INFO("+\n");
 
        _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
        GError *g_error = NULL;
@@ -987,11 +971,9 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               //LCOV_EXCL_START
                ERR("DBus error [%s]\n", g_error->message);
                g_error_free(g_error);
                return;
-               //LCOV_EXCL_STOP
        }
        g_variant_get(g_var, "(uu)", &event_type, &info);
        INFO("cfm event : %d info : %d\n", event_type, info);
@@ -1025,7 +1007,6 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
                        dcb(error, type, code, data);
                break;
 
-       //LCOV_EXCL_START
        case MOBILE_AP_DISABLE_USB_TETHERING_CFM:
                sigs[E_SIGNAL_USB_TETHER_OFF].sig_id = g_dbus_connection_signal_subscribe(th->client_bus,
                                NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_USB_TETHER_OFF].name,
@@ -1075,9 +1056,8 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
        default:
                ERR("Invalid event\n");
                break;
-       //LCOV_EXCL_STOP
        }
-       INFO("-\n"); //LCOV_EXCL_LINE
+       INFO("-\n");
 }
 
 static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
@@ -1097,7 +1077,6 @@ static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
 
        g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               //LCOV_EXCL_START
                ERR("DBus fail [%s]\n", g_error->message);
                if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        tethering_error = TETHERING_ERROR_PERMISSION_DENIED;
@@ -1105,10 +1084,9 @@ static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
                        tethering_error = TETHERING_ERROR_OPERATION_FAILED;
 
                flag = true;
-               //LCOV_EXCL_STOP
        }
        if (th->data_usage_cb == NULL) {
-               ERR("There is no data_usage_cb\n"); //LCOV_EXCL_LINE
+               ERR("There is no data_usage_cb\n");
                return;
        }
        if (flag) {
@@ -1139,21 +1117,23 @@ static void __settings_reloaded_cb(GObject *source_object, GAsyncResult *res,
 
        g_var  = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
        if (g_error) {
-               ERR("DBus fail [%s]\n", g_error->message); //LCOV_EXCL_LINE
+               ERR("DBus fail [%s]\n", g_error->message);
                if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        tethering_error = TETHERING_ERROR_PERMISSION_DENIED;
                else
                        tethering_error = TETHERING_ERROR_OPERATION_FAILED;
                g_error_free(g_error);
+       } else {
+               g_variant_get(g_var, "(u)", &info);
+               if (tethering_error == TETHERING_ERROR_NONE)
+                       tethering_error = __get_error(info);
+               g_variant_unref(g_var);
        }
+
        if (th->settings_reloaded_cb == NULL) {
                DBG("There is no settings_reloaded_cb\n-\n");
                return;
        }
-       g_variant_get(g_var, "(u)", &info);
-       if (tethering_error == TETHERING_ERROR_NONE)
-               tethering_error = __get_error(info);
-       g_variant_unref(g_var);
 
        th->settings_reloaded_cb(tethering_error,
                        th->settings_reloaded_user_data);
@@ -1204,24 +1184,18 @@ static bool __get_intf_name(tethering_type_e type, char *buf, unsigned int len)
        _retvm_if(buf == NULL, false, "parameter(buf) is NULL\n");
 
        switch (type) {
-       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_strlcpy(buf, TETHERING_USB_IF, len);
                break;
-       //LCOV_EXCL_STOP
        case TETHERING_TYPE_WIFI:
                g_strlcpy(buf, TETHERING_WIFI_IF, len);
                break;
-
        case TETHERING_TYPE_BT:
                g_strlcpy(buf, TETHERING_BT_IF, len);
                break;
-
-       //LCOV_EXCL_START
        default:
                ERR("Not supported type : %d\n", type);
                return false;
-       //LCOV_EXCL_STOP
        }
        return true;
 }
@@ -1231,23 +1205,18 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le
        _retvm_if(buf == NULL, false, "parameter(buf) is NULL\n");
 
        switch (type) {
-       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_strlcpy(buf, TETHERING_USB_GATEWAY, len);
                break;
-       //LCOV_EXCL_STOP
        case TETHERING_TYPE_WIFI:
                g_strlcpy(buf, TETHERING_WIFI_GATEWAY, len);
                break;
-
        case TETHERING_TYPE_BT:
                g_strlcpy(buf, TETHERING_BT_GATEWAY, len);
                break;
-       //LCOV_EXCL_START
        default:
                ERR("Not supported type : %d\n", type);
                return false;
-       //LCOV_EXCL_STOP
        }
        return true;
 }
@@ -1255,7 +1224,7 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le
 static int __get_common_ssid(char *ssid, unsigned int size)
 {
        if (ssid == NULL) {
-               ERR("ssid is null\n"); //LCOV_EXCL_LINE
+               ERR("ssid is null\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
@@ -1310,7 +1279,7 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
        char *ptr = NULL;
 
        if (th == NULL || set == NULL) {
-               ERR("null parameter\n-\n"); //LCOV_EXCL_LINE
+               ERR("null parameter\n-\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
 
@@ -1352,7 +1321,6 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
                                NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
                if (error) {
-                       //LCOV_EXCL_START
                        ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -1362,7 +1330,6 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se
 
                        g_error_free(error);
                        return ret;
-                       //LCOV_EXCL_STOP
                }
 
                if (parameters != NULL) {
@@ -1443,19 +1410,15 @@ API int tethering_create(tethering_h *tethering)
 
        if (__generate_initial_passphrase(th->passphrase,
                        sizeof(th->passphrase)) == 0) {
-               //LCOV_EXCL_START
                ERR("random passphrase generation failed\n");
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
 
        if (__get_common_ssid(ssid, sizeof(ssid)) != TETHERING_ERROR_NONE) {
-               //LCOV_EXCL_START
                ERR("common ssid get failed\n");
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
 
 #if !GLIB_CHECK_VERSION(2, 36, 0)
@@ -1464,14 +1427,12 @@ API int tethering_create(tethering_h *tethering)
        GCancellable *cancellable = g_cancellable_new();
        th->client_bus = g_bus_get_sync(DBUS_BUS_SYSTEM, cancellable, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("Couldn't connect to the System bus[%s]", error->message);
                g_error_free(error);
                g_cancellable_cancel(cancellable);
                g_object_unref(cancellable);
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
        th->cancellable = cancellable;
 
@@ -1479,7 +1440,6 @@ API int tethering_create(tethering_h *tethering)
                        NULL, TETHERING_SERVICE_NAME, TETHERING_SERVICE_OBJECT_PATH,
                        TETHERING_SERVICE_INTERFACE, th->cancellable, &error);
        if (!th->client_bus_proxy) {
-               //LCOV_EXCL_START
                if (error)
                        ERR("Couldn't create the proxy object because of %s\n", error->message);
                g_cancellable_cancel(th->cancellable);
@@ -1487,7 +1447,6 @@ API int tethering_create(tethering_h *tethering)
                g_object_unref(th->client_bus);
                free(th);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
 
        __connect_signals((tethering_h)th);
@@ -1573,15 +1532,12 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
        g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_INFINITE);
 
        if (__check_precondition(type) == FALSE) {
-               //LCOV_EXCL_START
                INFO("-\n");
                g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
 
        switch (type) {
-       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_USB_TETHER_ON].sig_id);
@@ -1591,18 +1547,15 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                                G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
                                (GAsyncReadyCallback) __usb_enabled_cfm_cb, (gpointer)tethering);
                break;
-       //LCOV_EXCL_STOP
 
        case TETHERING_TYPE_WIFI: {
                _softap_settings_t set = {"", "", "", 0, false};
 
                ret = __prepare_wifi_settings(tethering, &set);
                if (ret != TETHERING_ERROR_NONE) {
-                       //LCOV_EXCL_START
                        ERR("softap settings initialization failed\n");
                        DBG("-\n");
                        return TETHERING_ERROR_OPERATION_FAILED;
-                       //LCOV_EXCL_STOP
                }
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
@@ -1625,7 +1578,6 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
 
                break;
 
-       //LCOV_EXCL_START
        case TETHERING_TYPE_P2P: {
                _softap_settings_t p2p_set = {"", "", "", 0, false};
                ret = __prepare_wifi_settings(tethering, &p2p_set);
@@ -1691,7 +1643,6 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type)
                DBG("-\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
        }
-       //LCOV_EXCL_STOP
 
        g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT);
        INFO("-\n");
@@ -1717,11 +1668,9 @@ API int tethering_ipv6_enable(tethering_h tethering, tethering_type_e type)
        g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_INFINITE);
 
        if (__check_precondition(type) == FALSE) {
-               //LCOV_EXCL_START
                DBG("-\n");
                g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
 
        switch (type) {
@@ -1868,7 +1817,6 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
        GDBusConnection *connection = th->client_bus;
 
        switch (type) {
-       //LCOV_EXCL_START
        case TETHERING_TYPE_USB:
                g_dbus_connection_signal_unsubscribe(connection,
                                sigs[E_SIGNAL_USB_TETHER_OFF].sig_id);
@@ -1879,7 +1827,6 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                                (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
 
                break;
-       //LCOV_EXCL_STOP
 
        case TETHERING_TYPE_WIFI:
 
@@ -1903,7 +1850,6 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                                (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
                break;
 
-       //LCOV_EXCL_START
        case TETHERING_TYPE_P2P:
                g_dbus_proxy_call(proxy, "disable_p2p_tethering",
                                NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
@@ -1940,7 +1886,6 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type)
                ERR("Not supported tethering type [%d]\n", type);
                DBG("-\n");
                return TETHERING_ERROR_INVALID_PARAMETER;
-       //LCOV_EXCL_STOP
        }
        INFO("-\n");
        return TETHERING_ERROR_NONE;
@@ -2015,9 +1960,9 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type)
 API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
-       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
+       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
        else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
-       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
+       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
 
        _retvm_if(tethering_is_enabled(tethering, type) == false,
                        TETHERING_ERROR_NOT_ENABLED,
@@ -2039,11 +1984,9 @@ API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type,
        _retvm_if(s < 0, TETHERING_ERROR_OPERATION_FAILED,
                        "getting socket is failed\n");
        if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
-               //LCOV_EXCL_START
                ERR("getting mac is failed\n");
                close(s);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
        close(s);
 
@@ -2134,9 +2077,9 @@ API int tethering_get_network_interface_name(tethering_h tethering, tethering_ty
 API int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
-       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
+       if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
        else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
-       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
+       else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
 
        _retvm_if(tethering_is_enabled(tethering, type) == false,
                        TETHERING_ERROR_NOT_ENABLED,
@@ -2355,10 +2298,14 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
        result = g_dbus_proxy_call_sync(th->client_bus_proxy, "get_station_info",
                        NULL, G_DBUS_CALL_FLAGS_NONE,
                        -1, th->cancellable, &error);
-       if (error)
-               ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); //LCOV_EXCL_LINE
+
+       if (error) {
+               ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
+               g_error_free(error);
+               return TETHERING_ERROR_OPERATION_FAILED;
+       }
+
        g_variant_get(result, "(a(a{sv}))", &outer_iter);
-       //LCOV_EXCL_START
        while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) {
                g_variant_get(station, "a{sv}", &inner_iter);
                while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) {
@@ -2419,7 +2366,6 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                        g_free(client.hostname);
                        client.hostname = NULL;
                        g_variant_iter_free(outer_iter);
-                       g_variant_unref(station);
                        g_variant_unref(result);
                        DBG("-\n");
                        return TETHERING_ERROR_OPERATION_FAILED;
@@ -2427,9 +2373,7 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ
                g_free(client.hostname);
                client.hostname = NULL;
        }
-       //LCOV_EXCL_STOP
        g_variant_iter_free(outer_iter);
-       g_variant_unref(station);
        g_variant_unref(result);
        DBG("-\n");
        return TETHERING_ERROR_NONE;
@@ -2902,7 +2846,6 @@ API int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_s
 
        ret = __set_security_type(type);
        if (ret == TETHERING_ERROR_NONE) {
-
                switch (type) {
                case TETHERING_WIFI_SECURITY_TYPE_NONE:
                        sec_str = TETHERING_WIFI_SECURITY_TYPE_OPEN_STR;
@@ -2943,6 +2886,8 @@ API int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_s
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
 
+       _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(tethering) is NULL\n");
        _retvm_if(type == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(type) is NULL\n");
 
@@ -3044,7 +2989,7 @@ API int tethering_wifi_get_ssid(tethering_h tethering, char **ssid)
        }
 
        if (*ssid == NULL) {
-               ERR("strdup is failed\n"); //LCOV_EXCL_LINE
+               ERR("strdup is failed\n");
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -3108,6 +3053,8 @@ API int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible)
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
 
+       _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(tethering) is NULL\n");
        _retvm_if(visible == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(visible) is NULL\n");
 
@@ -3158,7 +3105,6 @@ API int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphr
                        g_variant_new("(s)", passphrase), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3168,7 +3114,6 @@ API int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphr
 
                g_error_free(error);
                return ret;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &ret);
@@ -3220,7 +3165,6 @@ API int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3230,7 +3174,6 @@ API int tethering_wifi_get_passphrase(tethering_h tethering, char **passphrase)
 
                g_error_free(error);
                return ret;
-               //LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -3338,13 +3281,13 @@ API int tethering_wifi_reload_settings(tethering_h tethering, tethering_wifi_set
        DBG("+\n");
 
        if (th->settings_reloaded_cb) {
-               ERR("Operation in progress\n"); //LCOV_EXCL_LINE
+               ERR("Operation in progress\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
        ret = __prepare_wifi_settings(tethering, &set);
        if (ret != TETHERING_ERROR_NONE) {
-               ERR("softap settings initialization failed\n"); //LCOV_EXCL_LINE
+               ERR("softap settings initialization failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
@@ -3396,33 +3339,36 @@ static int __add_mac_to_file(const char *filepath, const char *mac)
        bool mac_exist = false;
        char *p_mac = NULL;
 
-       p_mac = strdup(mac);
-       if (p_mac == NULL) {
-               ERR("strdup failed\n"); //LCOV_EXCL_LINE
-               return TETHERING_ERROR_OUT_OF_MEMORY;
-       }
-
        fp = fopen(filepath, "a+");
        if (!fp) {
-               ERR("fopen is failed\n"); //LCOV_EXCL_LINE
+               ERR("fopen is failed\n");
                return TETHERING_ERROR_OPERATION_FAILED;
        }
 
        while (fgets(line, MAX_BUF_SIZE, fp) != NULL) {
                if (strncmp(mac, line, 17) == 0) {
-                       DBG("MAC %s already exist in the list\n", mac); //LCOV_EXCL_LINE
+                       DBG("MAC %s already exist in the list\n", mac);
                        mac_exist = true;
                        break;
                }
        }
 
        if (!mac_exist) {
+               p_mac = strdup(mac);
+               if (p_mac == NULL) {
+                       ERR("strdup failed\n");
+                       fclose(fp);
+                       return TETHERING_ERROR_OUT_OF_MEMORY;
+               }
+
                fprintf(fp, "%s\n", mac);
 
                if ((strcmp(filepath, ALLOWED_LIST) == 0))
                        allowed_list = g_slist_append(allowed_list, p_mac);
                else if ((strcmp(filepath, BLOCKED_LIST) == 0))
                        blocked_list = g_slist_append(blocked_list, p_mac);
+               else
+                       free(p_mac);
        }
 
        fclose(fp);
@@ -3592,7 +3538,6 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable)
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        result = TETHERING_ERROR_PERMISSION_DENIED;
@@ -3603,7 +3548,6 @@ API int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable)
                th->dhcp_enabled = false;
 
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3641,7 +3585,6 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c
                        g_variant_new("(ss)", rangestart, rangestop),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3653,7 +3596,6 @@ API int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, c
                th->dhcp_enabled = false;
 
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3699,11 +3641,9 @@ API int tethering_wifi_set_txpower(tethering_h tethering, unsigned int txpower)
                        G_DBUS_CALL_FLAGS_NONE,
                        -1, th->cancellable, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
                g_clear_error(&error);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
        return TETHERING_ERROR_NONE;
 }
@@ -3718,6 +3658,8 @@ API int tethering_wifi_get_txpower(tethering_h tethering, unsigned int *txpower)
 
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
+       _retvm_if(txpower == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(txpower) is NULL\n");
        _retvm_if(tethering_is_enabled(tethering, TETHERING_TYPE_WIFI) == false,
                        TETHERING_ERROR_NOT_ENABLED,
                        "tethering type[%d] is not enabled\n", TETHERING_TYPE_WIFI);
@@ -3733,12 +3675,10 @@ API int tethering_wifi_get_txpower(tethering_h tethering, unsigned int *txpower)
                g_variant_get(result, "(u)", txpower);
                g_variant_unref(result);
        } else {
-               //LCOV_EXCL_START
                if (error)
                        ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
                g_clear_error(&error);
                return TETHERING_ERROR_OPERATION_FAILED;
-               //LCOV_EXCL_STOP
        }
        g_clear_error(&error);
        return TETHERING_ERROR_NONE;
@@ -3764,7 +3704,6 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu)
                        g_variant_new("(u)", mtu),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3774,7 +3713,6 @@ API int tethering_wifi_set_mtu(tethering_h tethering, unsigned int mtu)
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3806,7 +3744,6 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac)
                        g_variant_new("(s)", mac),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3816,7 +3753,6 @@ API int tethering_wifi_change_mac(tethering_h tethering, char *mac)
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3879,7 +3815,6 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable
                        g_variant_new("(b)", enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3889,7 +3824,6 @@ API int tethering_wifi_enable_port_forwarding(tethering_h tethering, bool enable
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3907,8 +3841,14 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
 
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
+       _retvm_if(ifname == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(ifname) is NULL\n");
        _retvm_if(protocol == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(protocol) is NULL\n");
+       _retvm_if(org_ip == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(org_ip) is NULL\n");
+       _retvm_if(final_ip == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(final_ip) is NULL\n");
 
        GVariant *parameters;
        GError *error = NULL;
@@ -3924,7 +3864,6 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
                        g_variant_new("(sssisi)", ifname, protocol, org_ip, org_port, final_ip, final_port),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3934,7 +3873,6 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3944,7 +3882,7 @@ API int tethering_wifi_add_port_forwarding_rule(tethering_h tethering, char *ifn
 
        list = strdup(cmd);
        if (list == NULL) {
-               ERR("strdup failed\n"); //LCOV_EXCL_LINE
+               ERR("strdup failed\n");
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -3972,7 +3910,6 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering)
        parameters = g_dbus_proxy_call_sync(proxy, "reset_port_forwarding_rule",
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -3982,7 +3919,6 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering)
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -3992,7 +3928,7 @@ API int tethering_wifi_reset_port_forwarding_rule(tethering_h tethering)
        return TETHERING_ERROR_NONE;
 }
 
-API int tethering_wifi_is_port_forwarding_enabled(tethering_h tethering, boolforwarding_enabled)
+API int tethering_wifi_is_port_forwarding_enabled(tethering_h tethering, bool *forwarding_enabled)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
@@ -4043,7 +3979,6 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable)
                        g_variant_new("(b)", enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4053,7 +3988,6 @@ API int tethering_wifi_enable_port_filtering(tethering_h tethering, bool enable)
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4088,7 +4022,6 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
                        g_variant_new("(isb)", port, protocol, allow),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4098,7 +4031,6 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4110,7 +4042,7 @@ API int tethering_wifi_add_port_filtering_rule(tethering_h tethering, int port,
                ret = asprintf(&list, "%s "FILTERING_RULE_STR, IPTABLES, TABLE_FILTER, TETH_FILTER_FW, protocol, port, ACTION_DROP);
 
        if (ret == -1 || list == NULL) {
-               ERR("asprintf failed\n"); //LCOV_EXCL_LINE
+               ERR("asprintf failed\n");
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -4145,7 +4077,6 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
                        g_variant_new("(iisb)", port1, port2, protocol, allow),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4155,7 +4086,6 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4167,7 +4097,7 @@ API int tethering_wifi_add_custom_port_filtering_rule(tethering_h tethering, int
                ret = asprintf(&list, "%s "FILTERING_MULTIPORT_RULE_STR, IPTABLES, TABLE_FILTER, TETH_FILTER_FW, protocol, port1, port2, ACTION_DROP);
 
        if (ret == -1 || list == NULL) {
-               ERR("asprintf failed\n"); //LCOV_EXCL_LINE
+               ERR("asprintf failed\n");
                return TETHERING_ERROR_OUT_OF_MEMORY;
        }
 
@@ -4206,7 +4136,7 @@ API int tethering_wifi_get_custom_port_filtering_rule(tethering_h tethering, voi
        return TETHERING_ERROR_NONE;
 }
 
-API int tethering_wifi_is_port_filtering_enabled(tethering_h tethering, boolfiltering_enabled)
+API int tethering_wifi_is_port_filtering_enabled(tethering_h tethering, bool *filtering_enabled)
 {
        CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
        CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
@@ -4243,7 +4173,6 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering
                        g_variant_new("(ib)", type, enable),
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4253,7 +4182,6 @@ API int tethering_wifi_set_vpn_passthrough_rule(tethering_h tethering, tethering
 
                g_error_free(error);
                return result;
-               //LCOV_EXCL_STOP
        }
 
        g_variant_get(parameters, "(u)", &result);
@@ -4280,7 +4208,6 @@ API int tethering_wifi_push_wps_button(tethering_h tethering)
                        NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4290,7 +4217,6 @@ API int tethering_wifi_push_wps_button(tethering_h tethering)
 
                g_error_free(error);
                return ret;
-               //LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {
@@ -4308,6 +4234,9 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin)
 
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL");
+       _retvm_if(wps_pin == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+                       "parameter(wps_pin) is NULL");
+
        __tethering_h *th = (__tethering_h *)tethering;
        GDBusProxy *proxy = th->client_bus_proxy;
        GVariant *parameters = NULL;
@@ -4318,7 +4247,6 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin)
                        g_variant_new("(s)", wps_pin), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
 
        if (error) {
-               //LCOV_EXCL_START
                ERR("g_dbus_proxy_call_sync failed because  %s\n", error->message);
 
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -4328,7 +4256,6 @@ API int tethering_wifi_set_wps_pin(tethering_h tethering, const char *wps_pin)
 
                g_error_free(error);
                return ret;
-               //LCOV_EXCL_STOP
        }
 
        if (parameters != NULL) {