• Genjian Zhang's avatar
    btrfs: fix uninitialized variable warnings · 8ba7d5f5
    Genjian Zhang authored
    There are some warnings on older compilers (gcc 10, 7) or non-x86_64
    architectures (aarch64).  As btrfs wants to enable -Wmaybe-uninitialized
    by default, fix the warnings even though it's not necessary on recent
    compilers (gcc 12+).
    
    ../fs/btrfs/volumes.c: In function ‘btrfs_init_new_device’:
    ../fs/btrfs/volumes.c:2703:3: error: ‘seed_devices’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2703 |   btrfs_setup_sprout(fs_info, seed_devices);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ../fs/btrfs/send.c: In function ‘get_cur_inode_state’:
    ../include/linux/compiler.h:70:32: error: ‘right_gen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       70 |   (__if_trace.miss_hit[1]++,1) :  \
          |                                ^
    ../fs/btrfs/send.c:1878:6: note: ‘right_gen’ was declared here
     1878 |  u64 right_gen;
          |      ^~~~~~~~~
    Reported-by: default avatark2ci <kernel-bot@kylinos.cn>
    Signed-off-by: default avatarGenjian Zhang <zhanggenjian@kylinos.cn>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    [ update changelog ]
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    8ba7d5f5
volumes.c 217 KB