|WARNING| [2/2] examples/vhost: remove unused but set globals

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Thu Sep 3 21:48:13 CEST 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/169081

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-03

# DPDK Patch Review

## Patch 1/2: examples/qos_sched: fix unused but set global errors

### Summary
This patch removes unused global variables `app_numa_mask` and `app_used_port_mask` that were set but never read.

### Review Findings

**No issues found.** The patch correctly removes dead code - variables that are written to but never read. The removal is clean and does not affect any functionality.

---

## Patch 2/2: examples/vhost: remove unused but set globals

### Summary
This patch removes unused variable `num_queues` and the intermediate variable `num_vmdq_queues` that only fed it.

### Review Findings

**Errors:**

1. **Variable overwrite before read (dead store)**
   ```c
   /* Line 464-466 in the patched code */
   num_pf_queues = dev_info.max_rx_queues - dev_info.vmdq_queue_num;
   queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
   vmdq_queue_base = dev_info.vmdq_queue_base;
   ```
   
   The variable `queues_per_pool` is assigned here but may not be read before being overwritten elsewhere in the function (cannot fully verify from the patch context alone). However, more critically, after this patch `queues_per_pool` is now assigned but its only consumer (`num_vmdq_queues = num_devices * queues_per_pool;`) has been removed.
   
   **Impact:** This creates a new unused-but-set variable issue. If `queues_per_pool` is not used elsewhere in `port_init()` after this point, it should also be removed. If it IS used later, then the patch is correct. The patch should verify this and potentially remove `queues_per_pool` as well if it's now dead code.

**Suggested fix:**
Audit whether `queues_per_pool` is used after the removed line. If not, remove its assignment:
```c
/* Only keep if queues_per_pool is actually used later */
num_pf_queues = dev_info.max_rx_queues - dev_info.vmdq_queue_num;
/* Remove: queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools; */
vmdq_queue_base = dev_info.vmdq_queue_base;
```

---

## Overall Assessment

**Patch 1/2:** Clean removal of dead code. No issues.

**Patch 2/2:** Potentially incomplete - may leave another unused variable (`queues_per_pool`). Needs verification that `queues_per_pool` is actually used elsewhere in the function after this point, or it should also be removed.


More information about the test-report mailing list