From 4c473dad3034e447cb577ad8c6675e55d8f824e1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 14 Nov 2015 13:31:11 +0100 Subject: [PATCH] card_emu: Fail with assert in case next_tpdu_state from wrong state --- firmware/src_simtrace/card_emu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/firmware/src_simtrace/card_emu.c b/firmware/src_simtrace/card_emu.c index 5eef7164..e129869c 100644 --- a/firmware/src_simtrace/card_emu.c +++ b/firmware/src_simtrace/card_emu.c @@ -17,6 +17,7 @@ * */ +#include #include #include #include @@ -286,6 +287,10 @@ process_byte_pts(struct card_handle *ch, uint8_t byte) /* FIXME: check PCK */ memcpy(ch->pts.resp, ch->pts.req, sizeof(ch->pts.resp)); break; + default: + TRACE_DEBUG("process_byte_pts() in invalid state %u\n", + ch->pts.state); + break; } /* calculate the next state and set it */ set_pts_state(ch, next_pts_state(ch)); @@ -412,6 +417,9 @@ static enum tpdu_state next_tpdu_state(struct card_handle *ch) case TPDU_S_WAIT_TX: return TPDU_S_WAIT_TX; } + /* we should never reach here */ + assert(0); + return -1; } static void send_tpdu_header(struct card_handle *ch)