[alsa-devel] [PATCH v3 2/2] ASoC: dapm: harden use of lookup tables

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Feb 4 21:58:53 CET 2019


On 2/4/19 2:27 PM, Pierre-Louis Bossart wrote:
> Add warnings when
> a) the table size isn't aligned with the enum list
> b) the values are not initialized. This requires an increase by one of all
> values to avoid the default 0.
>
> Suggested-by: Takashi Iwai <tiwai at suse.de>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> ---
>   include/sound/soc-dapm.h |   3 +
>   sound/soc/soc-dapm.c     | 163 +++++++++++++++++++++------------------
>   2 files changed, 90 insertions(+), 76 deletions(-)
>
> diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
> index 79b4ddfb8e9e..82de75b4de87 100644
> --- a/include/sound/soc-dapm.h
> +++ b/include/sound/soc-dapm.h
> @@ -523,6 +523,9 @@ enum snd_soc_dapm_type {
>   	snd_soc_dapm_asrc,		/* DSP/CODEC ASRC component */
>   	snd_soc_dapm_encoder,		/* FW/SW audio encoder component */
>   	snd_soc_dapm_decoder,		/* FW/SW audio decoder component */
> +
> +	/* Don't forget to change the following: */
> +	SND_SOC_DAPM_TYPE_LAST = snd_soc_dapm_decoder
>   };

And of course I sent the wrong version by forgetting to re-run git 
format-patch. This is just wrong with an off-by-one error. will send a 
correction, sorry for the noise.




More information about the Alsa-devel mailing list