subsys/testsuite: Fix coverity null dereference warning

Coverity is not able to detect that the call to ztest_test_fail()
will not return so it emits a warning on a later access to
param. Add a return; after the call so coverity won't complain.

Fixes #25790

Signed-off-by: David Leach <david.leach@nxp.com>
This commit is contained in:
David Leach 2020-07-24 14:03:33 -05:00 committed by Anas Nashif
commit 87e02c62bd

View file

@ -215,7 +215,12 @@ void z_ztest_check_expected_data(const char *fn, const char *name, void *data,
param = find_and_delete_value(&parameter_list, fn, name);
if (!param) {
PRINT("Failed to find parameter %s for %s\n", name, fn);
/* No return from this function but for coverity reasons
* put a return after to avoid the warning of a null
* dereference of param below.
*/
ztest_test_fail();
return;
}
expected = (void *)param->value;