struct ena_tx_buffer *tx_info);
 static int ena_create_io_tx_queues_in_range(struct ena_adapter *adapter,
                                            int first_index, int count);
+static void ena_free_all_io_tx_resources_in_range(struct ena_adapter *adapter,
+                                                 int first_index, int count);
 
 /* Increase a stat by cnt while holding syncp seqlock on 32bit machines */
 static void ena_increase_stat(u64 *statp, u64 cnt,
 
 static int ena_setup_and_create_all_xdp_queues(struct ena_adapter *adapter)
 {
+       u32 xdp_first_ring = adapter->xdp_first_ring;
+       u32 xdp_num_queues = adapter->xdp_num_queues;
        int rc = 0;
 
-       rc = ena_setup_tx_resources_in_range(adapter, adapter->xdp_first_ring,
-                                            adapter->xdp_num_queues);
+       rc = ena_setup_tx_resources_in_range(adapter, xdp_first_ring, xdp_num_queues);
        if (rc)
                goto setup_err;
 
-       rc = ena_create_io_tx_queues_in_range(adapter,
-                                             adapter->xdp_first_ring,
-                                             adapter->xdp_num_queues);
+       rc = ena_create_io_tx_queues_in_range(adapter, xdp_first_ring, xdp_num_queues);
        if (rc)
                goto create_err;
 
        return 0;
 
 create_err:
-       ena_free_all_io_tx_resources(adapter);
+       ena_free_all_io_tx_resources_in_range(adapter, xdp_first_ring, xdp_num_queues);
 setup_err:
        return rc;
 }