• Nikolay Borisov's avatar
    btrfs: remove err variable from btrfs_get_extent · 1028d1c4
    Nikolay Borisov authored
    There's no practical reason too use 'err' as a variable to convey
    errors. In fact it's value is either set explicitly in the beginning of
    the function or it simply takes the value of 'ret'. Not conforming to
    the usual pattern of having ret be the only variable used to convey
    errors makes the code more error prone to bugs. In fact one such bug
    was introduced by 6bf9e4bd ("btrfs: inode: Verify inode mode toi
    avoid NULL pointer dereference") by assigning the error value to 'ret'
    and not 'err'.
    
    Let's fix that issue and make the function less tricky by leaving only
    ret to convey error values.
    Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1028d1c4
inode.c 285 KB