From 7c6030075330b45515914a4f41a6f362ec9c7762 Mon Sep 17 00:00:00 2001 From: Mariusz Skamra Date: Thu, 1 Aug 2019 11:42:00 +0200 Subject: [PATCH] Bluetooth: Shell: Fix unregister GATT Metrics vendor service The 'registered' flag was not cleared when 'gatt metrics off' was called so that one was unable to register the service again. Remove 'registered' variable that is actually not needed as there is no tracking if service is already registered in similar cmd_register_test_svc command. If the service is already registered, the host will log an error. Fixes: #17882 Signed-off-by: Mariusz Skamra --- subsys/bluetooth/shell/gatt.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/shell/gatt.c b/subsys/bluetooth/shell/gatt.c index 61ee17cde0b..364ddecb778 100644 --- a/subsys/bluetooth/shell/gatt.c +++ b/subsys/bluetooth/shell/gatt.c @@ -881,14 +881,8 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[]) } if (!strcmp(argv[1], "on")) { - static bool registered; - - if (!registered) { - shell_print(shell, "Registering GATT metrics test " - "Service."); - err = bt_gatt_service_register(&met_svc); - registered = true; - } + shell_print(shell, "Registering GATT metrics test Service."); + err = bt_gatt_service_register(&met_svc); } else if (!strcmp(argv[1], "off")) { shell_print(shell, "Unregistering GATT metrics test Service."); err = bt_gatt_service_unregister(&met_svc);