From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E89C3F9D2; Tue, 12 Aug 2025 18:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755023141; cv=none; b=Cux80/ASEMuYKAqF3yR55hK948Yw8lgr2yCDRI4Nil1A6/y2qwP47ZLP6MmAoKT/WPQzNd1icVBbZj4luSl1o/ZYG3mRkNYFU845v9+p9MomJK5M0mP8efPPXHZ3DPMZbpg27RhT2sdAzmjd+H3osL9so+TN3TnZiYP3j280YR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755023141; c=relaxed/simple; bh=OnA49B/0UoEK7Ft9OxXswvuujCEJXyVYD1iZp82k7gM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AOkrsBYyoA2G5nXqAxpZ5KPyYMljpvb+r93bLDjlu3XY9kNaAmhcBq3OQ/VjxpuOYupmEfTEi3a7F738TJWYLkBk6TwpBoRumozbRK8rIH0dWfjvKzz39Mo2tACQoP0EAIyywvrAeIyG74FJpCzrsTXG7OaKcNRenVtED3x0//8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AzOlKX8K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AzOlKX8K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4371C4CEF0; Tue, 12 Aug 2025 18:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755023141; bh=OnA49B/0UoEK7Ft9OxXswvuujCEJXyVYD1iZp82k7gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AzOlKX8KDXX+HXtX4qsrrleHKkgAr0qZBuayEYmFtdS5a3pZdzHeWA/X688hJr6mY Jfr+hz0TbL5InXghyhbBBxOYs9iUZ6ftniHlHMu0kQCGcf8jZNo9BLevFzz099X3j6 aTUBIX1FkH3O72c8cLdw+4/pY0BIWgo8e6xFDYg8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Geoffrey D. Bennett" , Takashi Iwai Subject: [PATCH 6.12 354/369] ALSA: scarlett2: Add retry on -EPROTO from scarlett2_usb_tx() Date: Tue, 12 Aug 2025 19:30:51 +0200 Message-ID: <20250812173030.008825691@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812173014.736537091@linuxfoundation.org> References: <20250812173014.736537091@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Geoffrey D. Bennett commit 8a15ca0ca51399b652b1bbb23b590b220cf03d62 upstream. During communication with Focusrite Scarlett Gen 2/3/4 USB audio interfaces, -EPROTO is sometimes returned from scarlett2_usb_tx(), snd_usb_ctl_msg() which can cause initialisation and control operations to fail intermittently. This patch adds up to 5 retries in scarlett2_usb(), with a delay starting at 5ms and doubling each time. This follows the same approach as the fix for usb_set_interface() in endpoint.c (commit f406005e162b ("ALSA: usb-audio: Add retry on -EPROTO from usb_set_interface()")), which resolved similar -EPROTO issues during device initialisation, and is the same approach as in fcp.c:fcp_usb(). Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Closes: https://github.com/geoffreybennett/linux-fcp/issues/41 Cc: stable@vger.kernel.org Signed-off-by: Geoffrey D. Bennett Link: https://patch.msgid.link/aIdDO6ld50WQwNim@m.b4.vu Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/mixer_scarlett2.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -2329,6 +2329,8 @@ static int scarlett2_usb( struct scarlett2_usb_packet *req, *resp = NULL; size_t req_buf_size = struct_size(req, data, req_size); size_t resp_buf_size = struct_size(resp, data, resp_size); + int retries = 0; + const int max_retries = 5; int err; req = kmalloc(req_buf_size, GFP_KERNEL); @@ -2352,10 +2354,15 @@ static int scarlett2_usb( if (req_size) memcpy(req->data, req_data, req_size); +retry: err = scarlett2_usb_tx(dev, private->bInterfaceNumber, req, req_buf_size); if (err != req_buf_size) { + if (err == -EPROTO && ++retries <= max_retries) { + msleep(5 * (1 << (retries - 1))); + goto retry; + } usb_audio_err( mixer->chip, "%s USB request result cmd %x was %d\n",