Skip to content
  • Russell King's avatar
    regmap: regmap: avoid spurious warning in regmap_read_debugfs · a3471469
    Russell King authored
    
    
    Gcc warns about the case where regmap_read_debugfs tries to walk an
    empty map->debugfs_off_cache list, which would results in uninitialized
    variable getting returned, if we hadn't checked the same condition
    just before that.
    
    After an originally suggested inferior patch from Arnd Bergmann,
    this is the solution that Russell King came up with, sidestepping
    the problem by merging the error case for an empty list with the
    normal path.
    
    Without this patch, building mxs_defconfig results in:
    
    drivers/base/regmap/regmap-debugfs.c: In function 'regmap_read_debugfs':
    drivers/base/regmap/regmap-debugfs.c:147:9: : warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    
    Reported-by: default avatarVincent Stehle <v-stehle@ti.com>
    Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
    a3471469