[PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus

Alexey Klimov posted 1 patch 3 months, 3 weeks ago
drivers/base/regmap/regmap-slimbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus
Posted by Alexey Klimov 3 months, 3 weeks ago
Commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in
wcd934x_codec_parse_data()") revealed the problem in slimbus regmap.
That commit breaks audio playback, for instance, on sdm845 Thundercomm
Dragonboard 845c board:

 Unable to handle kernel paging request at virtual address ffff8000847cbad4
 Mem abort info:
   ESR = 0x0000000096000007
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
   FSC = 0x07: level 3 translation fault
 Data abort info:
   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
 swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000a1360000
 [ffff8000847cbad4] pgd=0000000000000000, p4d=100000010003e403, pud=100000010003f403, pmd=10000001025cf403, pte=0000000000000000
 Internal error: Oops: 0000000096000007 [#1]  SMP
 Modules linked in: (long list of modules...)
 CPU: 5 UID: 0 PID: 776 Comm: aplay Not tainted 6.18.0-rc1-00028-g7ea30958b305 #11 PREEMPT
 Hardware name: Thundercomm Dragonboard 845c (DT)
 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : slim_xfer_msg+0x24/0x1ac [slimbus]
 lr : slim_read+0x48/0x74 [slimbus]
 sp : ffff800089113330
 x29: ffff800089113350 x28: 00000000000000c0 x27: 0000000000000268
 x26: 0000000000000198 x25: 0000000000000001 x24: 0000000000000000
 x23: 0000000000000000 x22: ffff800089113454 x21: ffff00008488e800
 x20: ffff000084b4760a x19: 0000000000000001 x18: 0000000000000be2
 x17: 0000000000000c19 x16: ffffbcef364cd260 x15: ffffbcef36dafb10
 x14: 0000000000000d38 x13: 0000000000000cb4 x12: 0000000000000c91
 x11: 1fffe0001161b6e1 x10: ffff800089113470 x9 : ffff00008b0db70c
 x8 : ffff000081479ee0 x7 : 0000000000000000 x6 : 0000000000000800
 x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff00008263c200
 x2 : 0000000000000060 x1 : ffff800089113368 x0 : ffff8000847cb7c8
 Call trace:
  slim_xfer_msg+0x24/0x1ac [slimbus] (P)
  slim_read+0x48/0x74 [slimbus]
  regmap_slimbus_read+0x18/0x24 [regmap_slimbus]
  _regmap_raw_read+0xe8/0x174
  _regmap_bus_read+0x44/0x80
  _regmap_read+0x60/0xd8
  _regmap_update_bits+0xf4/0x140
  _regmap_select_page+0xa8/0x124
  _regmap_raw_write_impl+0x3b8/0x65c
  _regmap_bus_raw_write+0x60/0x80
  _regmap_write+0x58/0xc0
  regmap_write+0x4c/0x80
  wcd934x_hw_params+0x494/0x8b8 [snd_soc_wcd934x]
  snd_soc_dai_hw_params+0x3c/0x7c [snd_soc_core]
  __soc_pcm_hw_params+0x22c/0x634 [snd_soc_core]
  dpcm_be_dai_hw_params+0x1d4/0x38c [snd_soc_core]
  dpcm_fe_dai_hw_params+0x9c/0x17c [snd_soc_core]
  snd_pcm_hw_params+0x124/0x464 [snd_pcm]
  snd_pcm_common_ioctl+0x110c/0x1820 [snd_pcm]
  snd_pcm_ioctl+0x34/0x4c [snd_pcm]
  __arm64_sys_ioctl+0xac/0x104
  invoke_syscall+0x48/0x104
  el0_svc_common.constprop.0+0x40/0xe0
  do_el0_svc+0x1c/0x28
  el0_svc+0x34/0xec
  el0t_64_sync_handler+0xa0/0xf0
  el0t_64_sync+0x198/0x19c
 Code: 910083fd f9423464 f9000fe4 d2800004 (394c3003)
 ---[ end trace 0000000000000000 ]---

The __devm_regmap_init_slimbus() started to be used instead of
__regmap_init_slimbus() after the commit mentioned above and turns out
the incorrect bus_context pointer (3rd argument) was used in
__devm_regmap_init_slimbus(). It should be &slimbus->dev. Correct it.
The wcd934x codec seems to be the only (or the first) user of
devm_regmap_init_slimbus() but we should fix till the point where
__devm_regmap_init_slimbus() was introduced therefore two "Fixes" tags.

Fixes: 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")
Fixes: 7d6f7fb053ad ("regmap: add SLIMbus support")
Cc: stable@vger.kernel.org
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Ma Ke <make24@iscas.ac.cn>
Cc: Steev Klimaszewski <steev@kali.org>
Cc: Srinivas Kandagatla <srini@kernel.org>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---

The patch/fix is for the current 6.18 development cycle
since it is fixes the regression introduced in 6.18.0-rc1.

 drivers/base/regmap/regmap-slimbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c
index 54eb7d227cf4..edfee18fbea1 100644
--- a/drivers/base/regmap/regmap-slimbus.c
+++ b/drivers/base/regmap/regmap-slimbus.c
@@ -63,7 +63,7 @@ struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
 	if (IS_ERR(bus))
 		return ERR_CAST(bus);
 
-	return __devm_regmap_init(&slimbus->dev, bus, &slimbus, config,
+	return __devm_regmap_init(&slimbus->dev, bus, &slimbus->dev, config,
 				  lock_key, lock_name);
 }
 EXPORT_SYMBOL_GPL(__devm_regmap_init_slimbus);
-- 
2.47.3
Re: [PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus
Posted by Dmitry Baryshkov 3 months, 3 weeks ago
On Mon, Oct 20, 2025 at 02:55:57AM +0100, Alexey Klimov wrote:
> Commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in
> wcd934x_codec_parse_data()") revealed the problem in slimbus regmap.
> That commit breaks audio playback, for instance, on sdm845 Thundercomm
> Dragonboard 845c board:
> 
> 
> The __devm_regmap_init_slimbus() started to be used instead of
> __regmap_init_slimbus() after the commit mentioned above and turns out
> the incorrect bus_context pointer (3rd argument) was used in
> __devm_regmap_init_slimbus(). It should be &slimbus->dev. Correct it.
> The wcd934x codec seems to be the only (or the first) user of
> devm_regmap_init_slimbus() but we should fix till the point where
> __devm_regmap_init_slimbus() was introduced therefore two "Fixes" tags.
> 
> Fixes: 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")
> Fixes: 7d6f7fb053ad ("regmap: add SLIMbus support")
> Cc: stable@vger.kernel.org
> Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Cc: Ma Ke <make24@iscas.ac.cn>
> Cc: Steev Klimaszewski <steev@kali.org>
> Cc: Srinivas Kandagatla <srini@kernel.org>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---
> 
> The patch/fix is for the current 6.18 development cycle
> since it is fixes the regression introduced in 6.18.0-rc1.
> 
>  drivers/base/regmap/regmap-slimbus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c
> index 54eb7d227cf4..edfee18fbea1 100644
> --- a/drivers/base/regmap/regmap-slimbus.c
> +++ b/drivers/base/regmap/regmap-slimbus.c
> @@ -63,7 +63,7 @@ struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
>  	if (IS_ERR(bus))
>  		return ERR_CAST(bus);
>  
> -	return __devm_regmap_init(&slimbus->dev, bus, &slimbus, config,
> +	return __devm_regmap_init(&slimbus->dev, bus, &slimbus->dev, config,

Looking at regmap_slimbus_write(), the correct bus context should be
just 'slimbus' (which is equal to '&slimbus->dev', because dev is the
first field in struct slimbus_device. So, while the patch is correct,
I'd suggest just passing slimbus (and fixing __regmap_init_slimbus()
too).

>  				  lock_key, lock_name);
>  }
>  EXPORT_SYMBOL_GPL(__devm_regmap_init_slimbus);
> -- 
> 2.47.3
> 

-- 
With best wishes
Dmitry
Re: [PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus
Posted by Srinivas Kandagatla 3 months, 3 weeks ago

On 10/20/25 12:15 PM, Dmitry Baryshkov wrote:
> On Mon, Oct 20, 2025 at 02:55:57AM +0100, Alexey Klimov wrote:
>> Commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in
>> wcd934x_codec_parse_data()") revealed the problem in slimbus regmap.
>> That commit breaks audio playback, for instance, on sdm845 Thundercomm
>> Dragonboard 845c board:
>>
>>
>> The __devm_regmap_init_slimbus() started to be used instead of
>> __regmap_init_slimbus() after the commit mentioned above and turns out
>> the incorrect bus_context pointer (3rd argument) was used in
>> __devm_regmap_init_slimbus(). It should be &slimbus->dev. Correct it.
>> The wcd934x codec seems to be the only (or the first) user of
>> devm_regmap_init_slimbus() but we should fix till the point where
>> __devm_regmap_init_slimbus() was introduced therefore two "Fixes" tags.
>>
>> Fixes: 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")
>> Fixes: 7d6f7fb053ad ("regmap: add SLIMbus support")
>> Cc: stable@vger.kernel.org
>> Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> Cc: Ma Ke <make24@iscas.ac.cn>
>> Cc: Steev Klimaszewski <steev@kali.org>
>> Cc: Srinivas Kandagatla <srini@kernel.org>
>> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
>> ---
>>
>> The patch/fix is for the current 6.18 development cycle
>> since it is fixes the regression introduced in 6.18.0-rc1.
>>
>>  drivers/base/regmap/regmap-slimbus.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c
>> index 54eb7d227cf4..edfee18fbea1 100644
>> --- a/drivers/base/regmap/regmap-slimbus.c
>> +++ b/drivers/base/regmap/regmap-slimbus.c
>> @@ -63,7 +63,7 @@ struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus,
>>  	if (IS_ERR(bus))
>>  		return ERR_CAST(bus);
>>  
>> -	return __devm_regmap_init(&slimbus->dev, bus, &slimbus, config,
>> +	return __devm_regmap_init(&slimbus->dev, bus, &slimbus->dev, config,
> 
> Looking at regmap_slimbus_write(), the correct bus context should be
> just 'slimbus' (which is equal to '&slimbus->dev', because dev is the
> first field in struct slimbus_device. So, while the patch is correct,
> I'd suggest just passing slimbus (and fixing __regmap_init_slimbus()
> too).
+1
I agree, it adds more clarity to just pass slimbus instead of dev.

--srini> >>  				  lock_key, lock_name);
>>  }
>>  EXPORT_SYMBOL_GPL(__devm_regmap_init_slimbus);
>> -- 
>> 2.47.3
>>
>
Re: [PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus
Posted by Mark Brown 3 months, 3 weeks ago
On Mon, Oct 20, 2025 at 02:55:57AM +0100, Alexey Klimov wrote:
> Commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in
> wcd934x_codec_parse_data()") revealed the problem in slimbus regmap.
> That commit breaks audio playback, for instance, on sdm845 Thundercomm
> Dragonboard 845c board:
> 
>  Unable to handle kernel paging request at virtual address ffff8000847cbad4
>  Mem abort info:
>    ESR = 0x0000000096000007
>    EC = 0x25: DABT (current EL), IL = 32 bits
>    SET = 0, FnV = 0
>    EA = 0, S1PTW = 0
>    FSC = 0x07: level 3 translation fault

Please think hard before including complete backtraces in upstream
reports, they are very large and contain almost no useful information
relative to their size so often obscure the relevant content in your
message. If part of the backtrace is usefully illustrative (it often is
for search engines if nothing else) then it's usually better to pull out
the relevant sections.
Re: [PATCH] regmap: slimbus: fix bus_context pointer in __devm_regmap_init_slimbus
Posted by Abel Vesa 3 months, 3 weeks ago
On 25-10-20 02:55:57, Alexey Klimov wrote:
> Commit 4e65bda8273c ("ASoC: wcd934x: fix error handling in
> wcd934x_codec_parse_data()") revealed the problem in slimbus regmap.
> That commit breaks audio playback, for instance, on sdm845 Thundercomm
> Dragonboard 845c board:
> 
>  Unable to handle kernel paging request at virtual address ffff8000847cbad4
>  Mem abort info:
>    ESR = 0x0000000096000007
>    EC = 0x25: DABT (current EL), IL = 32 bits
>    SET = 0, FnV = 0
>    EA = 0, S1PTW = 0
>    FSC = 0x07: level 3 translation fault
>  Data abort info:
>    ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
>    CM = 0, WnR = 0, TnD = 0, TagAccess = 0
>    GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
>  swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000a1360000
>  [ffff8000847cbad4] pgd=0000000000000000, p4d=100000010003e403, pud=100000010003f403, pmd=10000001025cf403, pte=0000000000000000
>  Internal error: Oops: 0000000096000007 [#1]  SMP
>  Modules linked in: (long list of modules...)
>  CPU: 5 UID: 0 PID: 776 Comm: aplay Not tainted 6.18.0-rc1-00028-g7ea30958b305 #11 PREEMPT
>  Hardware name: Thundercomm Dragonboard 845c (DT)
>  pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
>  pc : slim_xfer_msg+0x24/0x1ac [slimbus]
>  lr : slim_read+0x48/0x74 [slimbus]
>  sp : ffff800089113330
>  x29: ffff800089113350 x28: 00000000000000c0 x27: 0000000000000268
>  x26: 0000000000000198 x25: 0000000000000001 x24: 0000000000000000
>  x23: 0000000000000000 x22: ffff800089113454 x21: ffff00008488e800
>  x20: ffff000084b4760a x19: 0000000000000001 x18: 0000000000000be2
>  x17: 0000000000000c19 x16: ffffbcef364cd260 x15: ffffbcef36dafb10
>  x14: 0000000000000d38 x13: 0000000000000cb4 x12: 0000000000000c91
>  x11: 1fffe0001161b6e1 x10: ffff800089113470 x9 : ffff00008b0db70c
>  x8 : ffff000081479ee0 x7 : 0000000000000000 x6 : 0000000000000800
>  x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff00008263c200
>  x2 : 0000000000000060 x1 : ffff800089113368 x0 : ffff8000847cb7c8
>  Call trace:
>   slim_xfer_msg+0x24/0x1ac [slimbus] (P)
>   slim_read+0x48/0x74 [slimbus]
>   regmap_slimbus_read+0x18/0x24 [regmap_slimbus]
>   _regmap_raw_read+0xe8/0x174
>   _regmap_bus_read+0x44/0x80
>   _regmap_read+0x60/0xd8
>   _regmap_update_bits+0xf4/0x140
>   _regmap_select_page+0xa8/0x124
>   _regmap_raw_write_impl+0x3b8/0x65c
>   _regmap_bus_raw_write+0x60/0x80
>   _regmap_write+0x58/0xc0
>   regmap_write+0x4c/0x80
>   wcd934x_hw_params+0x494/0x8b8 [snd_soc_wcd934x]
>   snd_soc_dai_hw_params+0x3c/0x7c [snd_soc_core]
>   __soc_pcm_hw_params+0x22c/0x634 [snd_soc_core]
>   dpcm_be_dai_hw_params+0x1d4/0x38c [snd_soc_core]
>   dpcm_fe_dai_hw_params+0x9c/0x17c [snd_soc_core]
>   snd_pcm_hw_params+0x124/0x464 [snd_pcm]
>   snd_pcm_common_ioctl+0x110c/0x1820 [snd_pcm]
>   snd_pcm_ioctl+0x34/0x4c [snd_pcm]
>   __arm64_sys_ioctl+0xac/0x104
>   invoke_syscall+0x48/0x104
>   el0_svc_common.constprop.0+0x40/0xe0
>   do_el0_svc+0x1c/0x28
>   el0_svc+0x34/0xec
>   el0t_64_sync_handler+0xa0/0xf0
>   el0t_64_sync+0x198/0x19c
>  Code: 910083fd f9423464 f9000fe4 d2800004 (394c3003)
>  ---[ end trace 0000000000000000 ]---
> 
> The __devm_regmap_init_slimbus() started to be used instead of
> __regmap_init_slimbus() after the commit mentioned above and turns out
> the incorrect bus_context pointer (3rd argument) was used in
> __devm_regmap_init_slimbus(). It should be &slimbus->dev. Correct it.
> The wcd934x codec seems to be the only (or the first) user of
> devm_regmap_init_slimbus() but we should fix till the point where
> __devm_regmap_init_slimbus() was introduced therefore two "Fixes" tags.
> 
> Fixes: 4e65bda8273c ("ASoC: wcd934x: fix error handling in wcd934x_codec_parse_data()")
> Fixes: 7d6f7fb053ad ("regmap: add SLIMbus support")
> Cc: stable@vger.kernel.org
> Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Cc: Ma Ke <make24@iscas.ac.cn>
> Cc: Steev Klimaszewski <steev@kali.org>
> Cc: Srinivas Kandagatla <srini@kernel.org>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>

Really straight-forward, so:

Reviewed-by: Abel Vesa <abel.vesa@linaro.org>

Best regards,
Abel