diff --git a/subsys/bluetooth/mesh/prov.c b/subsys/bluetooth/mesh/prov.c index cd5a19bf430..62a368f9331 100644 --- a/subsys/bluetooth/mesh/prov.c +++ b/subsys/bluetooth/mesh/prov.c @@ -1064,15 +1064,15 @@ static void prov_recv(const struct prov_bearer *bearer, void *cb_data, BT_DBG("type 0x%02x len %u", type, buf->len); - if (type != PROV_FAILED && type != link.expect) { - BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect); - prov_fail(PROV_ERR_UNEXP_PDU); + if (type >= ARRAY_SIZE(prov_handlers)) { + BT_ERR("Unknown provisioning PDU type 0x%02x", type); + prov_fail(PROV_ERR_NVAL_FMT); return; } - if (type >= ARRAY_SIZE(prov_handlers)) { - BT_ERR("Unknown provisioning PDU type 0x%02x", type); - prov_fail(PROV_ERR_NVAL_PDU); + if (type != PROV_FAILED && type != link.expect) { + BT_WARN("Unexpected msg 0x%02x != 0x%02x", type, link.expect); + prov_fail(PROV_ERR_UNEXP_PDU); return; }