]> git.hungrycats.org Git - linux/commitdiff
ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 4 Jun 2015 13:04:14 +0000 (16:04 +0300)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 4 Jul 2015 03:02:23 +0000 (23:02 -0400)
[ Upstream commit 80ba2669ec8c3e6517aa935001f6cb8809bf3df4 ]

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 <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
sound/soc/codecs/tas2552.c

index f039dc82597198f9f50686f98d480024176d5bf7..8543a061d47786b6522a0497c6cd333a8e2ad8f3 100644 (file)
@@ -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