[PATCH] test: Remove not needed null check
Andrew Goodbody
andrew.goodbody at linaro.org
Mon Oct 6 12:54:56 CEST 2025
In ut_report() there is a null check for stats but stats was already
dereferenced on the line before and is again dereferenced later in the
same function. Also the two places where ut_report() is called from will
have initialised the parameter so there is no chance that stats will be
null. So to prevent static analysis complaining of a use before check
just remove the check.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
test/test-main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test-main.c b/test/test-main.c
index cabc736a524eefacba44cf6fb31bd481f50938c6..3254325e8b153de465e8aab65930220228f2aae6 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -687,7 +687,7 @@ void ut_report(struct ut_stats *stats, int run_count)
else
printf("Tests");
printf(" run: %d, ", stats->test_count);
- if (stats && stats->test_count) {
+ if (stats->test_count) {
ulong dur = stats->duration_ms;
printf("%ld ms, average: %ld ms, ", dur,
---
base-commit: c280c4f7e52f08255f491783b3143a3be1fc08b0
change-id: 20251006-test_main-88babef9530a
Best regards,
--
Andrew Goodbody <andrew.goodbody at linaro.org>
More information about the U-Boot
mailing list