Re: [PATCH] btrfs: initialize return variable

From: David Sterba
Date: Mon May 03 2021 - 09:53:49 EST


On Fri, Apr 30, 2021 at 11:06:55AM -0700, trix@xxxxxxxxxx wrote:
> From: Tom Rix <trix@xxxxxxxxxx>
>
> 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.

Right, though it's unlikely the loop won't run at least once, having the
ret initialized is safe. Patch added to misc-next, thanks.