tools/btpclient: Initial check of ad_proxy presence in stop adv cmd 39/205039/1
authorGrzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
Fri, 19 Jan 2018 16:41:27 +0000 (17:41 +0100)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 29 Apr 2019 04:16:00 +0000 (09:46 +0530)
This patch covers with fail response if no advertising proxy was
registered at command beginning.

Change-Id: I6dcbf3b95e82b83c6ef782b272c924c2c9780f5d
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
tools/btpclient.c

index 2565a01..24990ec 100644 (file)
@@ -1162,19 +1162,15 @@ static void btp_gap_stop_advertising(uint8_t index, const void *param,
        }
 
        if (!l_dbus_proxy_get_property(adapter->proxy, "Powered", "b", &prop) ||
-                                                       !prop || !ad.registered)
+                               !prop || !adapter->ad_proxy || !ad.registered)
                goto failed;
 
-       if (adapter->ad_proxy) {
-               if (!l_dbus_proxy_method_call(adapter->ad_proxy,
+       if (!l_dbus_proxy_method_call(adapter->ad_proxy,
                                                "UnregisterAdvertisement",
                                                unreg_advertising_setup,
                                                stop_advertising_reply,
-                                               NULL, NULL)) {
-                       status = BTP_ERROR_FAIL;
-                       goto failed;
-               }
-       }
+                                               NULL, NULL))
+               goto failed;
 
        return;