]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Locker.cc: fix warning about 'Possible null pointer dereference'
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 1 Mar 2013 19:12:03 +0000 (20:12 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 11 Mar 2013 11:13:01 +0000 (12:13 +0100)
Fix following warning from cppcheck:
 [src/mds/Locker.cc:2255] -> [src/mds/Locker.cc:2258]: (error)
   Possible null pointer dereference: in - otherwise it is redundant
   to check it against null.

Since head_in used for call pick_inode_snap() is already valid,
there is no need to check if 'CInode *in' is not NULL. Remove
not needed check.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/mds/Locker.cc

index a3fe7b812da06a30a029c0b2ba5cc0d40dec13f3..e009fa0719c7286bebf540a8f1d6dceeee8e4352 100644 (file)
@@ -2248,15 +2248,13 @@ void Locker::handle_client_caps(MClientCaps *m)
     return;
   }
 
-  CInode *in = 0;
-  in = mdcache->pick_inode_snap(head_in, follows);
+  CInode *in = mdcache->pick_inode_snap(head_in, follows);
   if (in != head_in)
     dout(10) << " head inode " << *head_in << dendl;
   dout(10) << "  cap inode " << *in << dendl;
 
   Capability *cap = 0;
-  if (in) 
-    cap = in->get_client_cap(client);
+  cap = in->get_client_cap(client);
   if (!cap && in != head_in)
     cap = head_in->get_client_cap(client);
   if (!cap) {