drivers: can: remove unnecessary asserts

Remove unnecessary asserts from various CAN controller drivers. These
asserts are all covered by the common CAN subsystem API implementations.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2024-04-21 15:53:28 +00:00 committed by Carles Cufí
parent 0543657831
commit 71fe0f413b
11 changed files with 0 additions and 33 deletions

View file

@ -112,8 +112,6 @@ static int can_loopback_send(const struct device *dev,
uint8_t max_dlc = CAN_MAX_DLC;
int ret;
__ASSERT_NO_MSG(callback != NULL);
LOG_DBG("Sending %d bytes on %s. Id: 0x%x, ID type: %s %s",
frame->dlc, dev->name, frame->id,
(frame->flags & CAN_FRAME_IDE) != 0 ? "extended" : "standard",

View file

@ -921,8 +921,6 @@ int can_mcan_send(const struct device *dev, const struct can_frame *frame, k_tim
(frame->flags & CAN_FRAME_FDF) != 0U ? "FD frame" : "",
(frame->flags & CAN_FRAME_BRS) != 0U ? "BRS" : "");
__ASSERT_NO_MSG(callback != NULL);
#ifdef CONFIG_CAN_FD_MODE
if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_RTR | CAN_FRAME_FDF | CAN_FRAME_BRS)) !=
0) {
@ -1164,10 +1162,6 @@ int can_mcan_add_rx_filter(const struct device *dev, can_rx_callback_t callback,
const struct can_mcan_callbacks *cbs = config->callbacks;
int filter_id;
if (callback == NULL) {
return -EINVAL;
}
if ((filter->flags & ~(CAN_FILTER_IDE)) != 0U) {
LOG_ERR("unsupported CAN filter flags 0x%02x", filter->flags);
return -ENOTSUP;

View file

@ -537,8 +537,6 @@ static int mcp2515_send(const struct device *dev,
uint8_t len;
uint8_t tx_frame[MCP2515_FRAME_LEN];
__ASSERT_NO_MSG(callback != NULL);
if (frame->dlc > CAN_MAX_DLC) {
LOG_ERR("DLC of %d exceeds maximum (%d)",
frame->dlc, CAN_MAX_DLC);

View file

@ -496,8 +496,6 @@ static int mcp251xfd_send(const struct device *dev, const struct can_frame *msg,
msg->flags & CAN_FRAME_FDF ? "FD frame" : "",
msg->flags & CAN_FRAME_BRS ? "BRS" : "");
__ASSERT_NO_MSG(callback != NULL);
if (!dev_data->common.started) {
return -ENETDOWN;
}
@ -559,7 +557,6 @@ static int mcp251xfd_add_rx_filter(const struct device *dev, can_rx_callback_t r
int filter_idx;
int ret;
__ASSERT(rx_cb != NULL, "rx_cb can not be null");
k_mutex_lock(&dev_data->mutex, K_FOREVER);
for (filter_idx = 0; filter_idx < CONFIG_CAN_MAX_FILTER ; filter_idx++) {

View file

@ -671,8 +671,6 @@ static int mcux_flexcan_send(const struct device *dev,
uint8_t max_dlc = CAN_MAX_DLC;
int alloc;
__ASSERT_NO_MSG(callback != NULL);
if (UTIL_AND(IS_ENABLED(CONFIG_CAN_MCUX_FLEXCAN_FD),
((data->common.mode & CAN_MODE_FD) != 0U))) {
if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_RTR |
@ -772,8 +770,6 @@ static int mcux_flexcan_add_rx_filter(const struct device *dev,
int alloc = -ENOSPC;
int i;
__ASSERT_NO_MSG(callback);
if ((filter->flags & ~(CAN_FILTER_IDE)) != 0) {
LOG_ERR("unsupported CAN filter flags 0x%02x", filter->flags);
return -ENOTSUP;

View file

@ -138,8 +138,6 @@ static int can_native_linux_send(const struct device *dev, const struct can_fram
(frame->flags & CAN_FRAME_IDE) != 0 ? "extended" : "standard",
(frame->flags & CAN_FRAME_RTR) != 0 ? ", RTR frame" : "");
__ASSERT_NO_MSG(callback != NULL);
#ifdef CONFIG_CAN_FD_MODE
if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_RTR |
CAN_FRAME_FDF | CAN_FRAME_BRS)) != 0) {

View file

@ -464,8 +464,6 @@ static int can_nxp_s32_add_rx_filter(const struct device *dev,
int mb_indx;
uint32_t mask;
__ASSERT_NO_MSG(callback != NULL);
if ((filter->flags & ~(CAN_FILTER_IDE)) != 0) {
LOG_ERR("unsupported CAN filter flags 0x%02x", filter->flags);
return -ENOTSUP;
@ -555,8 +553,6 @@ static int can_nxp_s32_send(const struct device *dev,
enum can_state state;
int alloc, mb_indx;
__ASSERT_NO_MSG(callback != NULL);
#ifdef CAN_NXP_S32_FD_MODE
if ((frame->flags & ~(CAN_FRAME_IDE | CAN_FRAME_FDF | CAN_FRAME_BRS)) != 0) {
LOG_ERR("unsupported CAN frame flags 0x%02x", frame->flags);

View file

@ -888,9 +888,6 @@ static int can_rcar_send(const struct device *dev, const struct can_frame *frame
"extended" : "standard"
, (frame->flags & CAN_FRAME_RTR) != 0 ? "yes" : "no");
__ASSERT_NO_MSG(callback != NULL);
__ASSERT(frame->dlc == 0U || frame->data != NULL, "Dataptr is null");
if (frame->dlc > CAN_MAX_DLC) {
LOG_ERR("DLC of %d exceeds maximum (%d)",
frame->dlc, CAN_MAX_DLC);

View file

@ -378,8 +378,6 @@ int can_sja1000_send(const struct device *dev, const struct can_frame *frame, k_
uint8_t cmr;
uint8_t sr;
__ASSERT_NO_MSG(callback != NULL);
if (frame->dlc > CAN_MAX_DLC) {
LOG_ERR("TX frame DLC %u exceeds maximum (%d)", frame->dlc, CAN_MAX_DLC);
return -EINVAL;

View file

@ -774,9 +774,6 @@ static int can_stm32_send(const struct device *dev, const struct can_frame *fram
, (frame->flags & CAN_FRAME_IDE) != 0 ? "extended" : "standard"
, (frame->flags & CAN_FRAME_RTR) != 0 ? "yes" : "no");
__ASSERT_NO_MSG(callback != NULL);
__ASSERT(frame->dlc == 0U || frame->data != NULL, "Dataptr is null");
if (frame->dlc > CAN_MAX_DLC) {
LOG_ERR("DLC of %d exceeds maximum (%d)", frame->dlc, CAN_MAX_DLC);
return -EINVAL;

View file

@ -156,8 +156,6 @@ static int can_xmc4xxx_send(const struct device *dev, const struct can_frame *ms
msg->flags & CAN_FRAME_FDF ? "FD frame" : "",
msg->flags & CAN_FRAME_BRS ? "BRS" : "");
__ASSERT_NO_MSG(callback != NULL);
if (msg->dlc > CAN_XMC4XXX_MAX_DLC) {
return -EINVAL;
}