The TRAC register is only parsed in the Tx path if the debugfs entry is enabled. This does not look like a good idea because this register gives us the actual status of the transmitted packet. Let's always check the content of this register and error out when appropriate. Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> --- drivers/net/ieee802154/at86rf230.c | 49 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 616acfa8cd28..12ee071057d2 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -673,33 +673,36 @@ at86rf230_tx_trac_check(void *context) struct at86rf230_state_change *ctx = context; struct at86rf230_local *lp = ctx->lp; - if (IS_ENABLED(CONFIG_IEEE802154_AT86RF230_DEBUGFS)) { - u8 trac = TRAC_MASK(ctx->buf[1]); + u8 trac = TRAC_MASK(ctx->buf[1]); - switch (trac) { - case TRAC_SUCCESS: - lp->trac.success++; - break; - case TRAC_SUCCESS_DATA_PENDING: - lp->trac.success_data_pending++; - break; - case TRAC_CHANNEL_ACCESS_FAILURE: - lp->trac.channel_access_failure++; - break; - case TRAC_NO_ACK: - lp->trac.no_ack++; - break; - case TRAC_INVALID: - lp->trac.invalid++; - break; - default: - WARN_ONCE(1, "received tx trac status %d\n", trac); - lp->trac.invalid++; - break; - } + switch (trac) { + case TRAC_SUCCESS: + lp->trac.success++; + break; + case TRAC_SUCCESS_DATA_PENDING: + lp->trac.success_data_pending++; + break; + case TRAC_CHANNEL_ACCESS_FAILURE: + lp->trac.channel_access_failure++; + goto failure; + case TRAC_NO_ACK: + lp->trac.no_ack++; + goto failure; + case TRAC_INVALID: + lp->trac.invalid++; + goto failure; + default: + WARN_ONCE(1, "received tx trac status %d\n", trac); + lp->trac.invalid++; + goto failure; } at86rf230_async_state_change(lp, ctx, STATE_TX_ON, at86rf230_tx_on); + + return; + +failure: + at86rf230_async_error(lp, ctx, -EIO); } static void -- 2.27.0