]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: initialize return variable in cleanup_free_space_cache_v1
authorTom Rix <trix@redhat.com>
Fri, 30 Apr 2021 18:06:55 +0000 (11:06 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 4 May 2021 16:05:15 +0000 (18:05 +0200)
commitfa26e9d85289a6bb34e2873d25f6f68c94f40185
treec21766554b7d6f171fe308d5456ee450bb927d51
parentd983f7101f378553ec2b2b4b76d65acfc940e3e2
btrfs: initialize return variable in cleanup_free_space_cache_v1

Static analysis reports this problem

  free-space-cache.c:3965:2: warning: Undefined or garbage value returned
    return ret;
    ^~~~~~~~~~

ret is set in the node handling loop.  Treat doing nothing as a success
and initialize ret to 0, although it's unlikely the loop would be
skipped. We always have block groups, but as it could lead to
transaction abort in the caller it's better to be safe.

CC: stable@vger.kernel.org # 5.12+
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-cache.c