From: Erwan Velu Date: Tue, 12 Jan 2016 10:12:38 +0000 (+0100) Subject: os/bluestore/BlueStore: Simplifying default return value X-Git-Tag: v10.0.4~158^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fcac028db81ba066cf45c3b5f529a9a41c500227;p=ceph.git os/bluestore/BlueStore: Simplifying default return value r variable wasn't initialized but set to 0 twice. Once just before an early "goto out" code and the other before the main code of the function. This patch simply initialize r to 0 at the begining. This make the code easier to read and prevent any future call to "out" label without a proper value stored in r. Signed-off-by: Erwan Velu --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 304a02ac936d..52e6afddb717 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2411,7 +2411,7 @@ int BlueStore::_do_read( map::iterator bp, bend; map::iterator op, oend; uint64_t block_size = bdev->get_block_size(); - int r; + int r = 0; IOContext ioc(NULL); // FIXME? // generally, don't buffer anything, unless the client explicitly requests @@ -2433,7 +2433,6 @@ int BlueStore::_do_read( _dump_onode(o); if (offset > o->onode.size) { - r = 0; goto out; } @@ -2443,8 +2442,6 @@ int BlueStore::_do_read( o->flush(); - r = 0; - // loop over overlays and data fragments. overlays take precedence. bend = o->onode.block_map.end(); bp = o->onode.block_map.lower_bound(offset);