Re: [PATCH] ASoC: wm97xx: fix uninitialized regmap pointer problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 02, 2018 at 12:23:08PM +0100, Arnd Bergmann wrote:
> 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: 2ed1a8e0ce8d ("ASoC: wm9712: add ac97 new bus support")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
>  static void wm9713_soc_remove(struct snd_soc_component *component)
>  {
> -#ifdef CONFIG_SND_SOC_AC97_BUS
>  	struct wm9713_priv *wm9713 = snd_soc_component_get_drvdata(component);
>  
> -	if (!wm9713->mfd_pdata) {
> +	if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS)) {

Should this one not also have an && !wm9713->mfd_pdata?

Thanks,
Charles

>  		snd_soc_component_exit_regmap(component);
>  		snd_soc_free_ac97_component(wm9713->ac97);
>  	}
> -#endif
>  }
>  
>  static const struct snd_soc_component_driver soc_component_dev_wm9713 = {
> -- 
> 2.18.0
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux