mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
[mac] Print warnings on failure, not success (#2049)
In Mac::RadioReceive, Mac::RadioTransmit and Mac::RadioSleep, the SuccessOrExit macro was being used in a way which skipped printing an error message upon failure, and printed it for OT_ERROR_NONE.
This commit is contained in:
committed by
Jonathan Hui
parent
31b89311ba
commit
6c9bba5445
+19
-6
@@ -1097,9 +1097,13 @@ otError Mac::RadioTransmit(Frame *aSendFrame)
|
||||
|
||||
SuccessOrExit(error = otPlatRadioTransmit(&GetInstance(), static_cast<otRadioFrame *>(aSendFrame)));
|
||||
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error));
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1119,9 +1123,13 @@ otError Mac::RadioReceive(uint8_t aChannel)
|
||||
|
||||
SuccessOrExit(error = otPlatRadioReceive(&GetInstance(), aChannel));
|
||||
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioReceive() failed with error %s", otThreadErrorToString(error));
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioReceive() failed with error %s", otThreadErrorToString(error));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1146,11 +1154,16 @@ otError Mac::RadioSleep(void)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SuccessOrExit(error = otPlatRadioSleep(&GetInstance()));
|
||||
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioSleep() failed with error %s", otThreadErrorToString(error));
|
||||
|
||||
exit:
|
||||
|
||||
if (error != OT_ERROR_NONE)
|
||||
{
|
||||
otLogWarnMac(GetInstance(), "otPlatRadioSleep() failed with error %s", otThreadErrorToString(error));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user