]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: always initialize local variable
authorKefu Chai <kchai@redhat.com>
Mon, 27 May 2019 05:03:43 +0000 (13:03 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 27 May 2019 05:12:29 +0000 (13:12 +0800)
this change helps to silence warning like:

OSDMonitor.cc:13391:15: warning: ‘prio’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
13391 |       int64_t prio;
      |               ^~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/OSDMonitor.cc

index 0e8efd44a694b469cf2cb9b62169a16a16a849bc..8db5cdfeb9cc4bbcc0425bc72edfcb5c75a78985 100644 (file)
@@ -13388,7 +13388,7 @@ void OSDMonitor::convert_pool_priorities(void)
     const auto &pool = i.second;
 
     if (pool.opts.is_set(key)) {
-      int64_t prio;
+      int64_t prio = 0;
       pool.opts.get(key, &prio);
       if (prio > max_prio)
        max_prio = prio;