From: Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@kernel.org>
To: o-takashi@sakamocchi.jp, clemens@ladisch.de, tiwai@suse.com
Cc: stefanr@s5r6.in-berlin.de, linux-sound@vger.kernel.org,
perex@perex.cz, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] ALSA: firewire-lib: Abort the FCP transaction on a bus reset
Date: Sun, 22 Nov 2026 13:46:29 +0000 [thread overview]
Message-ID: <20261122-firewire-busreset-v2-1-e104d785c8a1@gmail.com> (raw)
In-Reply-To: <20261122-firewire-busreset-v2-0-e104d785c8a1@gmail.com>
From: Suyuan Wang <stevewong@hust.edu.cn>
When fcp_bus_reset() marks a transaction as STATE_BUS_RESET,
fcp_avc_transaction() sleeps and resends the command, but leaves the
state as it is. The response to the resent command is then ignored, and
the next wait returns at once, so the loop keeps resending the command
without a retry limit until sending fails.
The AV/C Digital Interface Command Set General Specification 4.2 says
that a target which detects a bus reset discards any AV/C transaction
in progress without returning a response. So instead of resending, end
the transaction on a bus reset and return -EAGAIN, so that the caller
can start the sequence again. ERROR_DELAY_MS and <linux/delay.h> have no
users left after this, so drop them.
Found with a static analysis tool and checked by hand.
Suggested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Fixes: 31ef9134eb52 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
sound/firewire/fcp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/firewire/fcp.c b/sound/firewire/fcp.c
index e60bfd0ee4ac..b8e7e2c90791 100644
--- a/sound/firewire/fcp.c
+++ b/sound/firewire/fcp.c
@@ -14,7 +14,6 @@
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
-#include <linux/delay.h>
#include "fcp.h"
#include "lib.h"
#include "amdtp-stream.h"
@@ -22,7 +21,6 @@
#define CTS_AVC 0x00
#define ERROR_RETRIES 3
-#define ERROR_DELAY_MS 5
#define FCP_TIMEOUT_MS 125
int avc_general_set_sig_fmt(struct fw_unit *unit, unsigned int rate,
@@ -272,7 +270,8 @@ int fcp_avc_transaction(struct fw_unit *unit,
ret = t.response_size;
break;
} else if (t.state == STATE_BUS_RESET) {
- msleep(ERROR_DELAY_MS);
+ ret = -EAGAIN;
+ break;
} else if (++tries >= ERROR_RETRIES) {
dev_err(&t.unit->device, "FCP command timed out\n");
ret = -EIO;
--
2.34.1
next prev parent reply other threads:[~2026-11-22 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 13:46 [PATCH v2 0/2] ALSA: firewire: Abort transactions " Suyuan Wang via B4 Relay
2026-11-22 13:46 ` Suyuan Wang via B4 Relay [this message]
2026-11-22 13:46 ` [PATCH v2 2/2] ALSA: fireworks: Abort the transaction " Suyuan Wang via B4 Relay
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=20261122-firewire-busreset-v2-1-e104d785c8a1@gmail.com \
--to=devnull+shyckless.gmail.com@kernel.org \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=shyckless@gmail.com \
--cc=stefanr@s5r6.in-berlin.de \
--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 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®