Browse files

firewire: ohci: fix too-early completion of IR multichannel buffers

commit 0c0efba upstream.

handle_ir_buffer_fill() assumed that a completed descriptor would be
indicated by a non-zero transfer_status (as in most other descriptors).
However, this field is written by the controller as soon as (the end of)
the first packet has been written into the buffer.  As a consequence, if
we happen to run into such a descriptor when the interrupt handler is
executed after such a packet has completed, the descriptor would be
taken out of the list of active descriptors as soon as the buffer had
been partially filled, so the event for the buffer being completely
filled would never be sent.

To fix this, handle descriptors only when they have been completely
filled, i.e., when res_count == 0.  (This also matches the condition
that is reported by the controller with an interrupt.)

Signed-off-by: Clemens Ladisch <>
Signed-off-by: Stefan Richter <>
Signed-off-by: Greg Kroah-Hartman <>
  • Loading branch information...
1 parent ae72c6c commit 74b7bd47282eb4729509c1adad27e05cb77a3837 @cladisch cladisch committed with gregkh Mar 12, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 drivers/firewire/ohci.c
@@ -2748,7 +2748,7 @@ static int handle_ir_buffer_fill(struct context *context,
container_of(context, struct iso_context, context);
u32 buffer_dma;
- if (!last->transfer_status)
+ if (last->res_count != 0)
/* Descriptor(s) not done yet, stop iteration */
return 0;
@@ -2762,8 +2762,7 @@ static int handle_ir_buffer_fill(struct context *context,
if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS)
le32_to_cpu(last->data_address) +
- le16_to_cpu(last->req_count) -
- le16_to_cpu(last->res_count),
+ le16_to_cpu(last->req_count),
return 1;

0 comments on commit 74b7bd4

Please sign in to comment.