btrfs-progs: Initialize del_slot to eliminate compilation warnings.
PATCH 1/1 btrfs-progs: Initialize del_slot to eliminate compilation warnings.
When compiling btrfs-progs with gcc 12.2.0, there is a warning that a variable may be used uninitialized.
In function ‘reset_balance’,
inlined from ‘reinit_extent_tree’ at check/main.c:9625:8,
inlined from ‘cmd_check’ at check/main.c:10712:10:check/main.c:9444:23: warning: ‘del_slot’ may be used uninitialized [-Wmaybe-uninitialized]
9444 | ret = btrfs_del_items(trans, root, &path, del_slot, del_nr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check/main.c: In function ‘cmd_check’:
check/main.c:9375:13: note: ‘del_slot’ was declared here
9375 | int del_slot, del_nr = 0;
| ^~~~~~~~Initialize it to 0 to eliminate this warning.
Signed-off-by Julian Sun <[email protected]>
--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
check/main.c +1 -1
@@ -9372,7 +9372,7 @@ static int reset_balance(struct btrfs_trans_handle *trans)struct btrfs_path path = {0 };struct extent_buffer *leaf;struct btrfs_key key; -int del_slot, del_nr =0 ; +int del_slot =0 , del_nr =0 ;int ret;int found =0 ;
Signature · 1 line
2.39.2