From: Kefu Chai Date: Thu, 20 Dec 2018 03:24:28 +0000 (+0800) Subject: cls/rbd: init local var with known value X-Git-Tag: v14.1.0~519^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25588%2Fhead;p=ceph.git cls/rbd: init local var with known value DirectoryState does not have an "invalid" enum so far, since it's defined using `enum class`, init a value of this type with a known value could be a better choice even it is always initialized before being read. this silences the GCC warning of: src/cls/rbd/cls_rbd.cc:3147:3: warning: ‘on_disk_directory_state’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (directory_state != on_disk_directory_state) { ^~ Signed-off-by: Kefu Chai --- diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index 40bb1a05196f..58f7001a9887 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -3130,7 +3130,7 @@ int dir_remove_image(cls_method_context_t hctx, bufferlist *in, bufferlist *out) */ int dir_state_assert(cls_method_context_t hctx, bufferlist *in, bufferlist *out) { - cls::rbd::DirectoryState directory_state; + cls::rbd::DirectoryState directory_state = cls::rbd::DIRECTORY_STATE_READY; try { auto iter = in->cbegin(); decode(directory_state, iter);