{
        struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
        struct gsi_trans_info *trans_info = &channel->trans_info;
+       u16 trans_index;
 
        spin_lock_bh(&trans_info->spinlock);
 
        list_move_tail(&trans->links, &trans_info->committed);
 
+       trans = list_first_entry_or_null(&trans_info->alloc,
+                                        struct gsi_trans, links);
+
        spin_unlock_bh(&trans_info->spinlock);
+
+       /* This allocated transaction is now committed */
+       trans_info->allocated_id++;
+
+       if (trans) {
+               trans_index = trans_info->allocated_id % channel->tre_count;
+               WARN_ON(trans != &trans_info->trans[trans_index]);
+       } else {
+               WARN_ON(trans_info->allocated_id != trans_info->free_id);
+       }
 }
 
 /* Move transactions from the committed list to the pending list */
 
        list_add_tail(&trans->links, &trans_info->alloc);
 
+       trans = list_first_entry(&trans_info->alloc, struct gsi_trans, links);
+
        spin_unlock_bh(&trans_info->spinlock);
 
+       WARN_ON(trans_info->allocated_id == trans_info->free_id);
+       trans_index = trans_info->allocated_id % channel->tre_count;
+       WARN_ON(trans != &trans_info->trans[trans_index]);
+
        return trans;
 }
 
        if (!last)
                return;
 
-       if (trans->used_count)
+       /* Unused transactions are allocated but never committed */
+       if (!trans->used_count)
+               trans_info->allocated_id++;
+       else
                ipa_gsi_trans_release(trans);
 
        /* Releasing the reserved TREs implicitly frees the sgl[] and
                                    GFP_KERNEL);
        if (!trans_info->trans)
                return -ENOMEM;
-       trans_info->free_id = 0;        /* modulo channel->tre_count */
+       trans_info->free_id = 0;        /* all modulo channel->tre_count */
+       trans_info->allocated_id = 0;
 
        /* A completion event contains a pointer to the TRE that caused
         * the event (which will be the last one used by the transaction).