[PATCH 2/3] firewire: core: check precondition when scheduling error callbacks
From: Takashi Sakamoto
Date: Sun Oct 18 2026 - 02:31:28 EST
Current implementation requires that the transaction not be on the
pending list before its error callback is scheduled. A WARN_ON() in the
callback function detects violations of this precondition, but the check
belongs in the scheduling helper.
Move the WARN_ON() to schedule_error_callback().
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/core-transaction.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 31cc440d4218..33f3f272e99b 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -84,8 +84,14 @@ static void invoke_callback(struct fw_transaction *t, int rcode, u32 response_ts
__t; \
})
+// Ensure that the transaction is not on the pending list when scheduling this work. Cancelling
+// the work after scheduling makes no sense, as the initiator must be notified of the transaction
+// result.
static void schedule_error_callback(struct fw_transaction *t, int rcode, u32 response_timestamp)
{
+ // To detect programming mistakes.
+ WARN_ON(!list_empty(&t->link));
+
t->rcode = rcode;
t->response_timestamp = response_timestamp;
@@ -153,16 +159,10 @@ __must_not_hold(&card->transactions.lock)
}
EXPORT_SYMBOL(fw_cancel_transaction);
-// Ensure that the transaction is not on the pending list when scheduling this work. Cancelling
-// the work after scheduling makes no sense, as the initiator must be notified of the transaction
-// result.
static void error_callback_work(struct work_struct *work)
{
struct fw_transaction *t = from_work(t, work, error_work);
- // To detect programming mistakes.
- WARN_ON(!list_empty(&t->link));
-
invoke_callback(t, t->rcode, t->response_timestamp, NULL, 0);
}
--
2.53.0