less violent error handling
This commit is contained in:
parent
7f84657aac
commit
b471012838
|
@ -27,8 +27,8 @@ void resetLuaCanRx() {
|
|||
}
|
||||
|
||||
void addLuaCanRxFilter(int32_t eid, uint32_t mask, int bus, int callback) {
|
||||
if (bus != ANY_BUS) {
|
||||
assertHwCanBusIndex(bus);
|
||||
if (bus != ANY_BUS && !isValidHwCanBusIndex(bus)) {
|
||||
efiPrintf("LUA CAN bus index %d is not valid", bus);
|
||||
}
|
||||
|
||||
if (filterCount >= maxFilterCount) {
|
||||
|
|
|
@ -335,9 +335,7 @@ bool getIsCanEnabled(void) {
|
|||
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
||||
void assertHwCanBusIndex(const size_t busIndex) {
|
||||
bool isValidHwCanBusIndex(const size_t busIndex) {
|
||||
// 'size_t' is an unsigned type so we are never below zero here
|
||||
if (busIndex > 1) {
|
||||
firmwareError(CUSTOM_OBD_70, "Invalid HW CAN bus index %d", busIndex);
|
||||
}
|
||||
return (busIndex <= 1);
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ void postCanState();
|
|||
|
||||
#endif /* EFI_CAN_SUPPORT */
|
||||
|
||||
void assertHwCanBusIndex(const size_t busIndex);
|
||||
bool isValidHwCanBusIndex(const size_t busIndex);
|
||||
|
|
Loading…
Reference in New Issue