mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/malloc_warnings_can' into 'master'
can: suppress clang tidy warning about nullptr dereference See merge request idf/esp-idf!5145
This commit is contained in:
commit
c5e89897ef
@ -353,7 +353,7 @@ static void can_alert_handler(uint32_t alert_code, int *alert_req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void can_intr_handler_err_warn(can_status_reg_t *status, BaseType_t *task_woken, int *alert_req)
|
static void can_intr_handler_err_warn(can_status_reg_t *status, int *alert_req)
|
||||||
{
|
{
|
||||||
if (status->bus) {
|
if (status->bus) {
|
||||||
if (status->error) {
|
if (status->error) {
|
||||||
@ -478,10 +478,15 @@ static void can_intr_handler_main(void *arg)
|
|||||||
status.val = can_get_status();
|
status.val = can_get_status();
|
||||||
intr_reason.val = (p_can_obj != NULL) ? can_get_interrupt_reason() : 0; //Incase intr occurs whilst driver is being uninstalled
|
intr_reason.val = (p_can_obj != NULL) ? can_get_interrupt_reason() : 0; //Incase intr occurs whilst driver is being uninstalled
|
||||||
|
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
if (intr_reason.val == 0) { // Teach clang-tidy that all bitfields are zero if a register is zero; othewise it warns about p_can_obj null dereference
|
||||||
|
intr_reason.err_warn = intr_reason.err_passive = intr_reason.bus_err = intr_reason.arb_lost = intr_reason.rx = intr_reason.tx = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//Handle error counter related interrupts
|
//Handle error counter related interrupts
|
||||||
if (intr_reason.err_warn) {
|
if (intr_reason.err_warn) {
|
||||||
//Triggers when Bus-Status or Error-status bits change
|
//Triggers when Bus-Status or Error-status bits change
|
||||||
can_intr_handler_err_warn(&status, &task_woken, &alert_req);
|
can_intr_handler_err_warn(&status, &alert_req);
|
||||||
}
|
}
|
||||||
if (intr_reason.err_passive) {
|
if (intr_reason.err_passive) {
|
||||||
//Triggers when entering/returning error passive/active state
|
//Triggers when entering/returning error passive/active state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user