Skip to content

Commit

Permalink
CAN: Fix semaphore unlock in the report tx handler
Browse files Browse the repository at this point in the history
Moved the semaphore unlock statement outside the `#endif` directive in `can.c`. This ensures proper unlocking of the semaphore for both cases, whether `CONFIG_THINGSET_CAN_PACKETIZED_REPORTS_TX` is enabled or not. Resolves the issue of warning and failure in TX CAN communication when the configuration is disabled.
  • Loading branch information
pasrom authored and martinjaeger committed Jan 4, 2024
1 parent ce07b58 commit b0885e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ static void thingset_can_report_tx_handler(struct k_work *work)
break;
}
}
k_sem_give(&sbuf->lock);
#else
LOG_WRN("Unable to send CAN frame with ID %x as it is too large (%d)", frame.id,
data_len);
#endif /* CONFIG_THINGSET_CAN_PACKETIZED_REPORTS_TX */
k_sem_give(&sbuf->lock);
}
else if (data_len > 0) {
memcpy(frame.data, sbuf->data, data_len);
Expand Down

0 comments on commit b0885e3

Please sign in to comment.