Skip to content

Commit

Permalink
ISO-TP fast: fix compiler warning and CAN sample build conf
Browse files Browse the repository at this point in the history
Fixes the following warning:
isotp_fast.c:210:1: warning: control reaches end of non-void function [-Wreturn-type]
  • Loading branch information
martinjaeger committed Apr 9, 2024
1 parent 74edabd commit 1f23a8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions samples/counter/can.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y

# CAN driver and ISO-TP subsystem
CONFIG_CAN=y
CONFIG_ISOTP=y
CONFIG_ISOTP_FAST=y

# ThingSet SDK
Expand Down
9 changes: 7 additions & 2 deletions subsys/canbus/isotp_fast/isotp_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,13 @@ struct isotp_fast_addr isotp_fast_get_reply_addr(struct isotp_fast_ctx *ctx,
return ctx->get_tx_addr_callback(addr);
#endif /* CONFIG_ISOTP_FAST_CUSTOM_ADDRESSING */
}
__ASSERT(false,
"addressing_mode mode either not set or set to an invalid value on isotp_fast_ctx");

/*
* This cannot be reached unless addressing_mode was set to an invalid value. As C cannot
* guarantee that no invalid value is set to the enum, we still need to return something to
* avoid a warning for -Wreturn-type.
*/
return *addr;
}

static void receive_report_error(struct isotp_fast_recv_ctx *rctx, int8_t err)
Expand Down

0 comments on commit 1f23a8c

Please sign in to comment.