mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
firewire: core: check precondition when scheduling error callbacks
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(). Link: https://lore.kernel.org/r/20261018063056.329226-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
parent
767e87bb6f
commit
31ab33a6e3
|
|
@ -88,8 +88,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;
|
||||
|
||||
|
|
@ -156,16 +162,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user