From: Dimitris Papastamos Date: Mon, 8 Nov 2010 15:37:07 +0000 (+0000) Subject: ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5aaa062c27273d21d1f52ddc20e697b6466057d4;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git ASoC: soc-cache: Use BUG_ON() for unsupported hw_read() calls Instead of dereferencing a NULL function pointer and falling apart use BUG_ON() for any unimplemented hw_read() calls. Signed-off-by: Dimitris Papastamos Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 8785a0c918d..e7479988dec 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c @@ -25,6 +25,7 @@ static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); } @@ -99,6 +100,7 @@ static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); } @@ -199,6 +201,7 @@ static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); } @@ -270,6 +273,7 @@ static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); } else { return cache[reg]; @@ -420,6 +424,7 @@ static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); } @@ -531,6 +536,7 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec, if (codec->cache_only) return -1; + BUG_ON(!codec->hw_read); return codec->hw_read(codec, reg); }