From: Peter Ujfalusi Date: Thu, 4 Jun 2015 13:04:14 +0000 (+0300) Subject: ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card X-Git-Tag: v4.2-rc1~109^2~38^2~2^3~16 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=80ba2669ec8c3e6517aa935001f6cb8809bf3df4;p=karo-tx-linux.git ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card If the card is not part of any card the tas_data->codec is NULL since it is set only during snd_soc_codec_driver.probe, which is not yet called. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c index ff82f46ba504..df89947f1032 100644 --- a/sound/soc/codecs/tas2552.c +++ b/sound/soc/codecs/tas2552.c @@ -120,6 +120,9 @@ static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown) { u8 cfg1_reg; + if (!tas_data->codec) + return; + if (sw_shutdown) cfg1_reg = 0; else