Skip to content
  • Arnd Bergmann's avatar
    ext2: avoid bogus -Wmaybe-uninitialized warning · e952813e
    Arnd Bergmann authored
    On ARM, we get this false-positive warning since the rework of
    the ext2_get_blocks interface:
    
    fs/ext2/inode.c: In function 'ext2_get_block':
    include/linux/buffer_head.h:340:16: error: 'bno' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    
    The calling conventions for this function are rather complex, and it's
    not surprising that the compiler gets this wrong, I spent a long time
    trying to understand how it all fits together myself.
    
    This change to avoid the warning makes sure the compiler sees that we
    always set 'bno' pointer whenever we have a positive return code.
    The transformation is correct because we always arrive at the 'got_it'
    label with a positive count that gets used as the return value, while
    any branch to the 'cleanup' label has a negative or zero 'err'.
    
    Fixes: 6750ad71
    
     ("ext2: stop passing buffer_head to ext2_get_blocks")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Cc: Dave Chinner <david@fromorbit.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    e952813e