vchiq: Better error handling

Fix the user library to avoid a seg-fault on a duplicate service error,
and ensure that errors in the errors in the vchiq_test functional test
cause the test to stop.
This commit is contained in:
popcornmix
2015-07-08 18:39:55 +01:00
parent ffdd891f14
commit b864a841e5
2 changed files with 9 additions and 3 deletions

View File

@@ -1669,7 +1669,8 @@ create_service(VCHIQ_INSTANCE_T instance,
{
vcos_mutex_lock(&instance->mutex);
service->lib_handle = VCHIQ_SERVICE_HANDLE_INVALID;
if (service)
service->lib_handle = VCHIQ_SERVICE_HANDLE_INVALID;
vcos_mutex_unlock(&instance->mutex);

View File

@@ -1273,6 +1273,7 @@ func_data_test(VCHIQ_SERVICE_HANDLE_T service, int datalen, int align, int serve
{
vcos_log_error("%d: Data corrupted at %x-%x (datalen %x, align %x, server_align %x) -> %02x", func_data_test_iter, i - diffs, i - 1, datalen, align, server_align, data[i-1]);
VCOS_BKPT;
success = 0;
diffs = 0;
}
}
@@ -1280,12 +1281,16 @@ func_data_test(VCHIQ_SERVICE_HANDLE_T service, int datalen, int align, int serve
{
vcos_log_error("%d: Data corrupted at %x-%x (datalen %x, align %x, server_align %x) -> %02x", func_data_test_iter, i - diffs, i - 1, datalen, align, server_align, data[i-1]);
VCOS_BKPT;
success = 0;
}
}
skip_iter:
func_data_test_iter++;
return VCHIQ_SUCCESS;
if (success)
{
func_data_test_iter++;
return VCHIQ_SUCCESS;
}
error_exit:
return VCHIQ_ERROR;