From 87a48a22b3809bac2d745cab84713d1631e28e23 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sun, 27 Sep 2026 13:44:06 +0900 Subject: [PATCH] firewire: core: remove unnecessary branch for timestamping when cancelling transaction request packets When fw_card_driver.cancel_packet() returns a non-zero value, the request subaction of the transaction has already finished. It means that the packet for the request subaction has already received an ack code and a timestamp, so there is no need to check them. Remove the unnecessary branch for the ack code and timestamp. Link: https://lore.kernel.org/r/20260927044407.65497-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index cefa92812361..88c0bfbe98ad 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -139,21 +139,16 @@ int fw_cancel_transaction(struct fw_card *card, if (card->driver->cancel_packet(card, &transaction->packet) == 0) return 0; + u32 curr_cycle_time = 0; + + // Timestamping on behalf of hardware. + (void)fw_card_read_cycle_time(card, &curr_cycle_time); + tstamp = cycle_time_to_ohci_tstamp(curr_cycle_time); + /* * If the request packet has already been sent, we need to see * if the transaction is still pending and remove it in that case. */ - - if (transaction->packet.ack == 0) { - // The timestamp is reused since it was just read now. - tstamp = transaction->packet.timestamp; - } else { - u32 curr_cycle_time = 0; - - (void)fw_card_read_cycle_time(card, &curr_cycle_time); - tstamp = cycle_time_to_ohci_tstamp(curr_cycle_time); - } - return close_transaction(transaction, card, RCODE_CANCELLED, tstamp); } EXPORT_SYMBOL(fw_cancel_transaction);