mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Ensure HAL status variables are initialized to zero (#3421)
HAL functions don't set the status variable on success, so it's possible to use the status variable in an uninitialized state.
This commit is contained in:
@@ -27,12 +27,11 @@ TEST(PWMSimTests, TestPwmInitialization) {
|
||||
INDEX_TO_TEST, &TestPwmInitializationCallback, &callbackParam, false);
|
||||
ASSERT_TRUE(0 != callbackId);
|
||||
|
||||
int32_t status;
|
||||
int32_t status = 0;
|
||||
HAL_PortHandle portHandle;
|
||||
HAL_DigitalHandle pwmHandle;
|
||||
|
||||
// Use out of range index
|
||||
status = 0;
|
||||
portHandle = 8000;
|
||||
gTestPwmCallbackName = "Unset";
|
||||
pwmHandle = HAL_InitializePWMPort(portHandle, nullptr, &status);
|
||||
|
||||
Reference in New Issue
Block a user