drivers: can: mcan: clear TX callback on failed TX

Elsewhere, "callback != NULL" is used to determine if the callback is in
use

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
This commit is contained in:
Grant Ramsay 2023-08-03 13:44:00 +12:00 committed by Fabio Baltieri
commit 08d19954b9

View file

@ -930,12 +930,14 @@ int can_mcan_send(const struct device *dev, const struct can_frame *frame, k_tim
err = can_mcan_write_reg(dev, CAN_MCAN_TXBAR, BIT(put_idx));
if (err != 0) {
goto err_unlock;
goto err_free_tx_cb;
}
k_mutex_unlock(&data->tx_mtx);
return 0;
err_free_tx_cb:
cbs->tx[put_idx].function = NULL;
err_unlock:
k_mutex_unlock(&data->tx_mtx);
k_sem_give(&data->tx_sem);