All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Šerif Rami" <ramiserifpersia@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org
Subject: Re: [PATCH v4 5/7] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls
Date: Thu, 14 Aug 2025 10:03:23 +0200	[thread overview]
Message-ID: <87ldnmuy7o.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250813131518.18985-6-ramiserifpersia@gmail.com>

On Wed, 13 Aug 2025 15:15:16 +0200,
Šerif Rami wrote:
> 
> +static int tascam_samplerate_get(struct snd_kcontrol *kcontrol,
> +				 struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct tascam_card *tascam =
> +		(struct tascam_card *)snd_kcontrol_chip(kcontrol);
> +	u8 *buf __free(kfree) = NULL;
> +	int err;
> +	u32 rate = 0;
> +
> +	guard(spinlock_irqsave)(&tascam->lock);
> +	if (tascam->current_rate > 0) {
> +		ucontrol->value.integer.value[0] = tascam->current_rate;
> +		return 0;
> +	}
> +	// Lock is released here before kmalloc and usb_control_msg

No, the lock isn't released!
You must use scoped_guard() in this case.

> +void tascam_midi_out_urb_complete(struct urb *urb)
> +{
....
> +	{
> +		guard(spinlock_irqsave)(&tascam->midi_out_lock);

Use scoped_guard().

> +static void tascam_midi_out_work_handler(struct work_struct *work)
> +{
....
> +		{
> +			guard(spinlock_irqsave)(&tascam->midi_out_lock);

Ditto.

> +			{
> +				guard(spinlock_irqsave)(&tascam->midi_out_lock);

Here, too.

Try to grep and check similar patterns are seen in other patches,
too.  I might have overlooked.


thanks,

Takashi

  reply	other threads:[~2025-08-14  8:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 13:15 [PATCH v4 0/7] ALSA: usb-audio: Add driver for TASCAM US-144MKII Šerif Rami
2025-08-13 13:15 ` [PATCH v4 1/7] ALSA: usb-audio: Add initial " Šerif Rami
2025-08-13 13:15 ` [PATCH v4 2/7] ALSA: usb-audio: us144mkii: Add PCM core infrastructure Šerif Rami
2025-08-14  7:55   ` Takashi Iwai
2025-08-13 13:15 ` [PATCH v4 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback Šerif Rami
2025-08-13 13:15 ` [PATCH v4 4/7] ALSA: usb-audio: us144mkii: Implement audio capture and decoding Šerif Rami
2025-08-14  7:59   ` Takashi Iwai
2025-08-13 13:15 ` [PATCH v4 5/7] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls Šerif Rami
2025-08-14  8:03   ` Takashi Iwai [this message]
2025-08-13 13:15 ` [PATCH v4 6/7] ALSA: usb-audio: us144mkii: Add deep sleep command Šerif Rami
2025-08-13 13:15 ` [PATCH v4 7/7] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII Šerif Rami

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=87ldnmuy7o.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=ramiserifpersia@gmail.com \
    --cc=tiwai@suse.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.