Skip to content

Commit

Permalink
ASoC: rockchip-spi-codec: fix kctonrol mute case crash
Browse files Browse the repository at this point in the history
fix kcontrol mute case crash, tested by `dumpsys car_service inject-vhal-event 289475072 1,0`.

[  136.260357][  T632] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[  136.262328][  T632] Mem abort info:
[  136.264924][  T632]   ESR = 0x96000005
[  136.265362][  T632]   EC = 0x25: DABT (current EL), IL = 32 bits
[  136.266072][  T632]   SET = 0, FnV = 0
[  136.266406][  T632]   EA = 0, S1PTW = 0
[  136.266772][  T632] Data abort info:
[  136.267094][  T632]   ISV = 0, ISS = 0x00000005
[  136.267518][  T632]   CM = 0, WnR = 0
[  136.267853][  T632] user pgtable: 4k pages, 39-bit VAs, pgdp=000000012871b000
[  136.268492][  T632] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
[  136.269342][  T632] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[  136.269899][  T632] Modules linked in: ahci_platform libahci_platform himax_mmi ohci_platform ili210x ohci_hcd
[  136.270788][  T632] CPU: 2 PID: 632 Comm: android.hardwar Not tainted 5.10.198 rockchip-linux#46
[  136.271453][  T632] Hardware name: Rockchip RK3588 VEHICLE EVB V22 Board (DT)
[  136.272077][  T632] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
[  136.272673][  T632] pc : spi_codec_ext_ch_mute_put+0x14/0x40
[  136.273178][  T632] lr : snd_ctl_elem_write+0x128/0x16c
[  136.273636][  T632] sp : ffffffc00e44bc10
[  136.273987][  T632] x29: ffffffc00e44bc10 x28: ffffff811e293900
[  136.274514][  T632] x27: 0000000000000000 x26: 0000000000000000
[  136.275040][  T632] x25: 0000000000000000 x24: ffffff81006024a0
[  136.275566][  T632] x23: ffffff8100602000 x22: 00000000c4c85513
[  136.276092][  T632] x21: ffffff8110838b00 x20: ffffff811cf0f000
[  136.276618][  T632] x19: ffffff8100602000 x18: ffffffc00dc45040
[  136.277144][  T632] x17: 0000000020000000 x16: 0000000000000001
[  136.277669][  T632] x15: 0000000000000000 x14: 000000020000001a
[  136.278195][  T632] x13: 754d206b63616279 x12: 0000000000000000
[  136.278722][  T632] x11: 0000000000006574 x10: 0000000000000000
[  136.279249][  T632] x9 : 0000000000000004 x8 : ffffff81038eb000
[  136.279781][  T632] x7 : 0000000000000000 x6 : ffffff811cf0f4c8
[  136.280311][  T632] x5 : ffffff811cf0f4c8 x4 : 0000000000000000
[  136.280840][  T632] x3 : 0000000000000000 x2 : ffffff811cf0f000
[  136.281367][  T632] x1 : ffffff811cf0f000 x0 : ffffff8107260c00
[  136.281894][  T632] Call trace:
[  136.282184][  T632]  spi_codec_ext_ch_mute_put+0x14/0x40
[  136.282655][  T632]  snd_ctl_elem_write+0x128/0x16c
[  136.283083][  T632]  snd_ctl_ioctl+0x7dc/0xb48
[  136.283479][  T632]  __arm64_sys_ioctl+0x90/0xc8
[  136.283888][  T632]  el0_svc_common+0xac/0x1ac
[  136.284283][  T632]  do_el0_svc+0x1c/0x28
[  136.284637][  T632]  el0_svc+0x10/0x1c
[  136.284968][  T632]  el0_sync_handler+0x68/0xac
[  136.285374][  T632]  el0_sync+0x164/0x180

Change-Id: I35ec1fb0974b8dd9b58bd6d8b2b362a414cb4cd7
Signed-off-by: Zheng Zhiqi <looper.zheng@rock-chips.com>
  • Loading branch information
Zheng Zhiqi authored and rkhuangtao committed Feb 4, 2024
1 parent f489571 commit f792fce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sound/soc/codecs/rockchip-spi-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ static int spi_codec_ext_ch_mute_get(struct snd_kcontrol *kcontrol,
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct spi_codec_private *priv = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
unsigned int ch = mc->reg;
unsigned int ch = (unsigned int)kcontrol->private_value;

ucontrol->value.integer.value[0] = priv->tdm_mute[ch];

Expand All @@ -161,8 +160,7 @@ static int spi_codec_ext_ch_mute_put(struct snd_kcontrol *kcontrol,
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct spi_codec_private *priv = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
unsigned int ch = mc->reg;
unsigned int ch = (unsigned int)kcontrol->private_value;

priv->tdm_mute[ch] = ucontrol->value.integer.value[0];

Expand Down

0 comments on commit f792fce

Please sign in to comment.