|WARNING| [v2] test: defer timer initialization
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Mon Oct 19 10:57:00 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/171627
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-19
# DPDK Patch Review
## ERRORS
None identified.
## WARNINGS
**test_timer_perf.c**: Resource leak on error path
```c
tms = rte_malloc(NULL, sizeof(*tms) * MAX_ITERATIONS, 0);
if (tms == NULL) {
printf("Failed to allocate memory for timers\n");
return TEST_FAILED;
}
```
After the timer subsystem init check is added, if `rte_timer_subsystem_init()` returns an error, the function returns `TEST_FAILED` without freeing `tms`. The `rte_malloc()` call should be moved after the timer init check to avoid the leak.
**Suggested fix:**
```c
int ret;
ret = rte_timer_subsystem_init();
if (ret < 0 && ret != -EALREADY) {
printf("timer subsystem init failed: %d\n", ret);
return TEST_FAILED;
}
tms = rte_malloc(NULL, sizeof(*tms) * MAX_ITERATIONS, 0);
if (tms == NULL) {
printf("Failed to allocate memory for timers\n");
return TEST_FAILED;
}
```
---
**test_timer_secondary.c**: Inconsistent brace style
The patch changes an if statement from multi-line with braces to single-line without braces:
```c
if (proc_type == RTE_PROC_PRIMARY && rte_lcore_count() < NUM_LCORES_NEEDED) {
printf("Not enough cores for test_timer_secondary, expecting at least %u\n",
NUM_LCORES_NEEDED);
return TEST_SKIPPED;
}
```
However, the body is two statements (printf + return), which requires braces according to DPDK style. This appears to be a multi-line statement incorrectly formatted as a single-statement body.
**Suggested fix:** Keep the braces since the body contains multiple statements.
## INFO
None.
Review-Result: WARNING
More information about the test-report
mailing list