From 2cf509da1d75d120ad46f84772c7aeb32f8ce2d8 Mon Sep 17 00:00:00 2001 From: Jianqun Xu Date: Sat, 28 Mar 2020 14:45:07 +0800 Subject: [PATCH] ASoC: codecs: rk817 fix shut down crash issue Requesting system reboot [ 7.936347] Unable to handle kernel NULL pointer dereference at virtual address 00000044 [ 7.937081] pgd = (ptrval) [ 7.937332] [00000044] *pgd=3d817835, *pte=00000000, *ppte=00000000 [ 7.937917] Internal error: Oops: 17 [#1] PREEMPT SMP ARM [ 7.938402] Modules linked in: [ 7.938699] CPU: 0 PID: 631 Comm: init Not tainted 4.19.111 #100 [ 7.939238] Hardware name: Generic DT based system [ 7.939686] PC is at snd_soc_component_update_bits+0x8/0x70 [ 7.940203] LR is at rk817_codec_power_down+0x170/0x1cc Change-Id: I68bb761346322750214f9fae8537d825d72f4a44 Signed-off-by: Jianqun Xu --- sound/soc/codecs/rk817_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c index 3b819a082c4d..fe57b4391816 100644 --- a/sound/soc/codecs/rk817_codec.c +++ b/sound/soc/codecs/rk817_codec.c @@ -1190,8 +1190,8 @@ static void rk817_platform_shutdown(struct platform_device *pdev) DBG("%s\n", __func__); - rk817_codec_power_down(rk817->component, RK817_CODEC_ALL); - + if (rk817 && rk817->component) + rk817_codec_power_down(rk817->component, RK817_CODEC_ALL); } static const struct of_device_id rk817_codec_dt_ids[] = {