ASoC: dapm: harden use of lookup tables
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 5 Feb 2019 16:22:28 +0000 (10:22 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 6 Feb 2019 17:32:02 +0000 (17:32 +0000)
commitf13d4b5f85e1c436c9bf21205509266b5a81a320
tree5217e1153720fbddc4939289e599ba8a8ca5ee16
parente29fe437ea5d926ea23d806b2468bf60ee8dc08a
ASoC: dapm: harden use of lookup tables

To detect potential errors, let's add:

a) build-time warnings when the table size isn't aligned with the enum
list
b) run-time warnings when the values are not initialized. This
requires an increase by one of all values to avoid the default 0.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c