This is an automated email from the ASF dual-hosted git repository.

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new b1ec600f7 nimble/ll: Fix build with clang 11 on mac
b1ec600f7 is described below

commit b1ec600f7582ea603bb5c581e7c2bbf27bdd39ba
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Oct 29 16:21:48 2024 +0100

    nimble/ll: Fix build with clang 11 on mac
    
    Looks like clang is not able to track relation between max_delay and
    calc_sch which are involve two separate if-else blocks.
    
    This is false positive.
    
    repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:9:
        error: variable 'max_delay' is used uninitialized whenever 'if' 
condition
            is false [-Werror,-Wsometimes-uninitialized]
        if (calc_sch) {
            ^~~~~~~~
    repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:586:35:
        note: uninitialized use occurs here
        rc = ble_ll_sched_insert(sch, max_delay, preempt_none);
                                      ^~~~~~~~~
    repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:568:5:
        note: remove the 'if' if its condition is always true
        if (calc_sch) {
        ^~~~~~~~~~~~~~
    repos/apache-mynewt-nimble/nimble/controller/src/ble_ll_sched.c:431:23:
        note: initialize the variable 'max_delay' to silence this warning
        uint32_t max_delay;
                          ^
                           = 0
---
 nimble/controller/src/ble_ll_sched.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nimble/controller/src/ble_ll_sched.c 
b/nimble/controller/src/ble_ll_sched.c
index f2987dfdf..8f4599bdf 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -428,7 +428,7 @@ ble_ll_sched_conn_central_new(struct ble_ll_conn_sm *connsm,
     uint32_t orig_start_time;
     uint32_t earliest_start = 0;
     uint32_t min_win_offset;
-    uint32_t max_delay;
+    uint32_t max_delay = 0;
     uint32_t adv_rxend;
     bool calc_sch = true;
     os_sr_t sr;
@@ -536,7 +536,6 @@ ble_ll_sched_conn_central_new(struct ble_ll_conn_sm *connsm,
             } else {
                 connsm->css_period_idx = css->period_anchor_idx;
             }
-            max_delay = 0;
         }
 
         /* Calculate anchor point and move to next period if scheduled too

Reply via email to