mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [1/7] incubator-mynewt-core git commit: nimble/ll: fix and refactor set rpa timeout
Date Wed, 18 Jan 2017 16:55:10 GMT
Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop ae4d7776e -> 607dfa5b2


nimble/ll: fix and refactor set rpa timeout

os_callout_reset return value was not assigned to rc.
Additionally code was refactored to improve readability.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f1a94d2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f1a94d2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f1a94d2a

Branch: refs/heads/develop
Commit: f1a94d2a32b7a93bae5ef6b90e249cb4494202a0
Parents: 8827489
Author: Michał Narajowski <michal.narajowski@codecoup.pl>
Authored: Tue Jan 10 13:25:59 2017 +0100
Committer: Michał Narajowski <michal.narajowski@codecoup.pl>
Committed: Wed Jan 18 11:12:08 2017 +0100

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_resolv.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f1a94d2a/net/nimble/controller/src/ble_ll_resolv.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_resolv.c b/net/nimble/controller/src/ble_ll_resolv.c
index 975f271..65a581e 100644
--- a/net/nimble/controller/src/ble_ll_resolv.c
+++ b/net/nimble/controller/src/ble_ll_resolv.c
@@ -354,21 +354,20 @@ ble_ll_resolv_local_addr_rd(uint8_t *cmdbuf)
 int
 ble_ll_resolv_set_rpa_tmo(uint8_t *cmdbuf)
 {
-    int rc;
     uint16_t tmo_secs;
 
     tmo_secs = le16toh(cmdbuf);
-    if ((tmo_secs > 0) && (tmo_secs <= 0xA1B8)) {
-        g_ble_ll_resolv_data.rpa_tmo = tmo_secs * OS_TICKS_PER_SEC;
-        if (g_ble_ll_resolv_data.addr_res_enabled) {
-            os_callout_reset(&g_ble_ll_resolv_data.rpa_timer,
-                             (int32_t)g_ble_ll_resolv_data.rpa_tmo);
-        }
-    } else {
-        rc = BLE_ERR_INV_HCI_CMD_PARMS;
+    if (!((tmo_secs > 0) && (tmo_secs <= 0xA1B8))) {
+        return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 
-    return rc;
+    if (!g_ble_ll_resolv_data.addr_res_enabled) {
+        return BLE_ERR_CMD_DISALLOWED;
+    }
+
+    g_ble_ll_resolv_data.rpa_tmo = tmo_secs * OS_TICKS_PER_SEC;
+    return os_callout_reset(&g_ble_ll_resolv_data.rpa_timer,
+                            (int32_t)g_ble_ll_resolv_data.rpa_tmo);
 }
 
 /**


Mime
View raw message