ASoC: Check for NULL register bank in snd_soc_get_cache_val()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Jun 2011 10:26:15 +0000 (11:26 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 6 Jun 2011 18:34:11 +0000 (19:34 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-cache.c

index 06b7b81a16016f714b9bb2597dc705c0bab20ffb..c005ceb70c9d1dfc624ffa11a13eec427e2215b9 100644 (file)
@@ -466,6 +466,9 @@ static bool snd_soc_set_cache_val(void *base, unsigned int idx,
 static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx,
                unsigned int word_size)
 {
+       if (!base)
+               return -1;
+
        switch (word_size) {
        case 1: {
                const u8 *cache = base;