]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Fix static variable initialization
authorJuergen Werner <juergen@opensourcerouting.org>
Tue, 1 Oct 2019 15:01:10 +0000 (17:01 +0200)
committerJuergen Werner <juergen@opensourcerouting.org>
Tue, 1 Oct 2019 15:27:39 +0000 (17:27 +0200)
Signed-off-by: Juergen Werner <juergen@opensourcerouting.org>
doc/developer/memtypes.rst
lib/frrcu.c

index 1af871963a8e75a4f67b7e340565872ce12b0b39..e04049001d9e569098c364c4ef509602f33ad47e 100644 (file)
@@ -52,6 +52,12 @@ Definition
    a function taking a ``struct memtype *`` argument can be called with an
    ``MTYPE_name`` argument (as opposed to ``&MTYPE_name``.)
 
+   .. note::
+
+      As ``MTYPE_name`` is a variable assigned from ``&_mt_name`` and not a
+      constant expression, it cannot be used as initializer for static
+      variables. In the case please fall back to ``&_mt_name``.
+
 .. c:macro:: DECLARE_MGROUP(name)
 
    This macro forward-declares a memory group and should be placed in a
index 7e6475b6487e5992a74b8cba5c83632ee5c2d480..d65a4a98bf631e4c5e3449aeeb748e8a5fde9ecc 100644 (file)
@@ -206,7 +206,7 @@ void rcu_thread_unprepare(struct rcu_thread *rt)
        rcu_bump();
        if (rt != &rcu_thread_main)
                /* this free() happens after seqlock_release() below */
-               rcu_free_internal(MTYPE_RCU_THREAD, rt, rcu_head);
+               rcu_free_internal(&_mt_RCU_THREAD, rt, rcu_head);
 
        rcu_threads_del(&rcu_threads, rt);
        seqlock_release(&rt->rcu);
@@ -269,7 +269,7 @@ static void rcu_bump(void)
         * "last item is being deleted - start over" case, and then we may end
         * up accessing old RCU queue items that are already free'd.
         */
-       rcu_free_internal(MTYPE_RCU_NEXT, rn, head_free);
+       rcu_free_internal(&_mt_RCU_NEXT, rn, head_free);
 
        /* Only allow the RCU sweeper to run after these 2 items are queued.
         *