• Arnd Bergmann's avatar
    ASoC: wm97xx: fix uninitialized regmap pointer problem · 576ce407
    Arnd Bergmann authored
    gcc notices that without either the ac97 bus or the pdata, we never
    initialize the regmap pointer, which leads to an uninitialized variable
    access:
    
    sound/soc/codecs/wm9712.c: In function 'wm9712_soc_probe':
    sound/soc/codecs/wm9712.c:666:2: error: 'regmap' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    
    Since that configuration is invalid, it's better to return an error
    here. I tried to avoid adding complexity to the conditions, and turned
    the #ifdef into a regular if(IS_ENABLED()) check for readability.
    This in turn requires moving some header file declarations out of
    an #ifdef.
    
    The same code is used in three drivers, all of which I'm changing
    the same way.
    
    Fixes: 2ed1a8e0 ("ASoC: wm9712: add ac97 new bus support")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    576ce407
wm9713.c 43.4 KB