All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: laurent.pinchart@ideasonboard.com
Cc: linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
	gregkh@linuxfoundation.org, john@keeping.me.uk,
	alsi@bang-olufsen.dk, ruslan.bilovol@gmail.com,
	kernel@pengutronix.de
Subject: [PATCH] usb: gadget: u_audio: initialize spinlocks
Date: Mon,  2 Oct 2023 08:42:31 +0200	[thread overview]
Message-ID: <20231002064231.2336627-1-m.grzeschik@pengutronix.de> (raw)

When using uac2 with lockdep enabled, the kernel is throwing this
message, due to uninitialized spinlocks. We initialize them now.

[   24.668867] The code is fine but needs lockdep annotation, or maybe
[   24.675878] you didn't initialize this object before use?
[   24.681910] turning off the locking correctness validator.
[   24.688038] CPU: 0 PID: 348 Comm: irq/43-dwc3 Tainted: G         C         6.5.0-20230919-1+ #14
[   24.697866] Hardware name: WolfVision PF5 (DT)
[   24.702831] Call trace:
[   24.705559]  dump_backtrace+0xac/0x130
[   24.709755]  show_stack+0x30/0x48
[   24.713456]  dump_stack_lvl+0x60/0xb0
[   24.717552]  dump_stack+0x18/0x28
[   24.721254]  register_lock_class+0x4e8/0x4f8
[   24.726029]  __lock_acquire+0x88/0x2130
[   24.730314]  lock_acquire+0x17c/0x338
[   24.734403]  _raw_spin_lock_irqsave+0x60/0x90
[   24.739274]  u_audio_get_capture_srate+0x34/0x68
[   24.744436]  afunc_setup+0x2d8/0x538
[   24.748431]  composite_setup+0x1a8/0x1ba8
[   24.752913]  configfs_composite_setup+0x88/0xc0
[   24.757974]  dwc3_ep0_interrupt+0x5e8/0xab8
[   24.762648]  dwc3_process_event_buf+0x424/0xbb0
[   24.767717]  dwc3_thread_interrupt+0x4c/0x90
[   24.772488]  irq_thread_fn+0x34/0xb8
[   24.776484]  irq_thread+0x1a0/0x290
[   24.780379]  kthread+0x10c/0x120
[   24.783985]  ret_from_fork+0x10/0x20

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/usb/gadget/function/u_audio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
index 4a42574b4a7feb..9d9f906adf7c00 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -1172,6 +1172,9 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
 	g_audio->uac = uac;
 	uac->audio_dev = g_audio;
 
+	spin_lock_init(&uac->c_prm.lock);
+	spin_lock_init(&uac->p_prm.lock);
+
 	params = &g_audio->params;
 	p_chmask = params->p_chmask;
 	c_chmask = params->c_chmask;
-- 
2.39.2


             reply	other threads:[~2023-10-02  6:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02  6:42 Michael Grzeschik [this message]
2023-10-02  7:03 ` [PATCH] usb: gadget: u_audio: initialize spinlocks Greg KH
2023-10-02  8:39 ` Ruslan Bilovol
2023-10-03 11:12   ` Michael Grzeschik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231002064231.2336627-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=alsi@bang-olufsen.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=john@keeping.me.uk \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ruslan.bilovol@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.