mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop()
@ 2026-02-02 14:41 Ziyi Guo
  2026-02-02 14:56 ` Richard Fitzgerald
  2026-02-27 10:03 ` Richard Fitzgerald
  0 siblings, 2 replies; 3+ messages in thread
From: Ziyi Guo @ 2026-02-02 14:41 UTC (permalink / raw)
  To: Simon Trimmer, Charles Keepax, Richard Fitzgerald
  Cc: patches, linux-kernel, Ziyi Guo

cs_dsp_signal_event_controls() calls cs_dsp_coeff_write_acked_control()
which has lockdep_assert_held(&dsp->pwr_lock), but the lock is not held.

cs_dsp_signal_event_controls() is invoked from cs_dsp_stop().

Put mutex_lock() at the top of cs_dsp_stop() to fix the
missing lock protection, also align with cs_dsp_run().

Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
---
v2:
 - Put mutex_lock() at the top of cs_dsp_stop() to fix and align with cs_dsp_run()

 drivers/firmware/cirrus/cs_dsp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 525ac0f0a75d..a491e89c0c97 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -2864,6 +2864,8 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_run, "FW_CS_DSP");
  */
 void cs_dsp_stop(struct cs_dsp *dsp)
 {
+	mutex_lock(&dsp->pwr_lock);
+
 	/* Tell the firmware to cleanup */
 	cs_dsp_signal_event_controls(dsp, CS_DSP_FW_EVENT_SHUTDOWN);
 
@@ -2874,7 +2876,6 @@ void cs_dsp_stop(struct cs_dsp *dsp)
 	if (dsp->ops->show_fw_status)
 		dsp->ops->show_fw_status(dsp);
 
-	mutex_lock(&dsp->pwr_lock);
 
 	if (dsp->client_ops->pre_stop)
 		dsp->client_ops->pre_stop(dsp);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop()
  2026-02-02 14:41 [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop() Ziyi Guo
@ 2026-02-02 14:56 ` Richard Fitzgerald
  2026-02-27 10:03 ` Richard Fitzgerald
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2026-02-02 14:56 UTC (permalink / raw)
  To: Ziyi Guo, Simon Trimmer, Charles Keepax; +Cc: patches, linux-kernel

On 02/02/2026 2:41 pm, Ziyi Guo wrote:
> cs_dsp_signal_event_controls() calls cs_dsp_coeff_write_acked_control()
> which has lockdep_assert_held(&dsp->pwr_lock), but the lock is not held.
> 
> cs_dsp_signal_event_controls() is invoked from cs_dsp_stop().
> 
> Put mutex_lock() at the top of cs_dsp_stop() to fix the
> missing lock protection, also align with cs_dsp_run().
> 
> Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
> ---
> v2:
>   - Put mutex_lock() at the top of cs_dsp_stop() to fix and align with cs_dsp_run()
> 
>   drivers/firmware/cirrus/cs_dsp.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
> index 525ac0f0a75d..a491e89c0c97 100644
> --- a/drivers/firmware/cirrus/cs_dsp.c
> +++ b/drivers/firmware/cirrus/cs_dsp.c
> @@ -2864,6 +2864,8 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_run, "FW_CS_DSP");
>    */
>   void cs_dsp_stop(struct cs_dsp *dsp)
>   {
> +	mutex_lock(&dsp->pwr_lock);
> +
>   	/* Tell the firmware to cleanup */
>   	cs_dsp_signal_event_controls(dsp, CS_DSP_FW_EVENT_SHUTDOWN);
>   
> @@ -2874,7 +2876,6 @@ void cs_dsp_stop(struct cs_dsp *dsp)
>   	if (dsp->ops->show_fw_status)
>   		dsp->ops->show_fw_status(dsp);
>   
> -	mutex_lock(&dsp->pwr_lock);
>   
>   	if (dsp->client_ops->pre_stop)
>   		dsp->client_ops->pre_stop(dsp);

Nitpick: Commit title "fix missing pwr_lock in cs_dsp_stop()", it's
not missing. Just in the wrong place.

Apart from that:
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop()
  2026-02-02 14:41 [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop() Ziyi Guo
  2026-02-02 14:56 ` Richard Fitzgerald
@ 2026-02-27 10:03 ` Richard Fitzgerald
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2026-02-27 10:03 UTC (permalink / raw)
  To: Ziyi Guo, Simon Trimmer, Charles Keepax; +Cc: patches, linux-kernel

On 02/02/2026 2:41 pm, Ziyi Guo wrote:
> cs_dsp_signal_event_controls() calls cs_dsp_coeff_write_acked_control()
> which has lockdep_assert_held(&dsp->pwr_lock), but the lock is not held.
> 
> cs_dsp_signal_event_controls() is invoked from cs_dsp_stop().
> 
> Put mutex_lock() at the top of cs_dsp_stop() to fix the
> missing lock protection, also align with cs_dsp_run().
> 
> Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
> ---
> v2:
>   - Put mutex_lock() at the top of cs_dsp_stop() to fix and align with cs_dsp_run()
>

You need to send this patch to Mark Brown <broonie@kernel.org> and also
add linux-sound@vger.kernel.org to your cc list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-27 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-02 14:41 [PATCH v2] firmware: cs_dsp: fix missing pwr_lock in cs_dsp_stop() Ziyi Guo
2026-02-02 14:56 ` Richard Fitzgerald
2026-02-27 10:03 ` Richard Fitzgerald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®