]> git.itanic.dy.fi Git - linux-stable/commitdiff
ceph: silence smatch warning in reconnect_caps_cb()
authorXiubo Li <xiubli@redhat.com>
Mon, 8 May 2023 06:45:01 +0000 (14:45 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 18 May 2023 09:15:28 +0000 (11:15 +0200)
Smatch static checker warning:

  fs/ceph/mds_client.c:3968 reconnect_caps_cb()
  warn: missing error code here? '__get_cap_for_mds()' failed. 'err' = '0'

[ idryomov: Dan says that Smatch considers it intentional only if the
  "ret = 0;" assignment is within 4 or 5 lines of the goto. ]

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c

index 29cf00220b09c41f553b31f573fc35b2cdd5c99f..4c0f22acf53d294a1c80e93f5c9ee8ad55bb8e3d 100644 (file)
@@ -3942,7 +3942,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
        struct dentry *dentry;
        struct ceph_cap *cap;
        char *path;
-       int pathlen = 0, err = 0;
+       int pathlen = 0, err;
        u64 pathbase;
        u64 snap_follows;
 
@@ -3965,6 +3965,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
        cap = __get_cap_for_mds(ci, mds);
        if (!cap) {
                spin_unlock(&ci->i_ceph_lock);
+               err = 0;
                goto out_err;
        }
        dout(" adding %p ino %llx.%llx cap %p %lld %s\n",