Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "YuanZhe Liu" <25031212351@stu.xidian.edu.cn>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/2] ALSA: 6fire: Don't resubmit an active MIDI URB
Date: Mon, 23 Nov 2026 08:56:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-228920@kernel.org> (raw)
In-Reply-To: <20261123084846.7700-2-25031212351@stu.xidian.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ALSA: 6fire: stale rt->out on submit failure in
  usb6fire_midi_out_handler()
--

commit e7fc7882a7e28efff90554bb8dc1de23ef94bfe7
Author: YuanZhe Liu <25031212351@stu.xidian.edu.cn>

ALSA: 6fire: Don't resubmit an active MIDI URB

This commit adds an out_urb_active flag to struct midi_runtime so
usb6fire_midi_out_trigger() defers URB submission to the completion
handler when the output URB is still in flight after a stream stop and
restart.

> diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
> index 279b449936e75..ae8a0d48eb410 100644
> --- a/sound/usb/6fire/midi.c
> +++ b/sound/usb/6fire/midi.c
> @@ -25,6 +25,7 @@ static void usb6fire_midi_out_handler(struct urb *urb)
>  	int ret;
>  
>  	guard(spinlock_irqsave)(&rt->out_lock);
> +	rt->out_urb_active = false;
>  
>  	if (rt->out) {
>  		ret = snd_rawmidi_transmit(rt->out, rt->out_buffer + 4,
> @@ -39,6 +40,8 @@ static void usb6fire_midi_out_handler(struct urb *urb)
>  				dev_err(&urb->dev->dev,
>  					"midi out urb submit failed: %d\n",
>  					ret);
> +			else
> +				rt->out_urb_active = true;
>  		} else /* no more data to transmit */
>  			rt->out = NULL;
>  	}

[Severity: Medium]
Should usb6fire_midi_out_handler() also clear rt->out = NULL when
usb_submit_urb() fails, the way usb6fire_midi_out_trigger() does?

When usb6fire_midi_out_trigger() defers a restarted stream to the
completion handler, it sets rt->out = alsa_sub and returns while
rt->out_urb_active is true.  If usb_submit_urb() then fails in
usb6fire_midi_out_handler(), rt->out_urb_active remains false with no URB
in flight, but rt->out stays non-NULL, causing subsequent trigger(1) calls
to return early at the if (rt->out) check without submitting the URB.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123084846.7700-1-25031212351@stu.xidian.edu.cn?part=1

  reply	other threads:[~2026-11-23  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  8:48 [PATCH 0/2] ALSA: 6fire: avoid resubmitting an active URB YuanZhe Liu
2026-11-23  8:48 ` [PATCH 1/2] ALSA: 6fire: Don't resubmit an active MIDI URB YuanZhe Liu
2026-11-23  8:56   ` sashiko-bot [this message]
2026-11-23  8:48 ` [PATCH 2/2] ALSA: 6fire: Don't resubmit an active PCM out URB YuanZhe Liu

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=sashiko-outbox-228920@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox