diff --git a/subsys/emul/emul_bmi160.c b/subsys/emul/emul_bmi160.c index 2b389d8e23..a35ee970c8 100644 --- a/subsys/emul/emul_bmi160.c +++ b/subsys/emul/emul_bmi160.c @@ -197,6 +197,10 @@ static int bmi160_emul_io_spi(struct spi_emul *emul, switch (tx->len) { case 1: regn = *(uint8_t *)tx->buf; + if ((regn & BMI160_REG_READ) && rxd == NULL) { + LOG_ERR("Cannot read without rxd"); + return -EPERM; + } switch (txd->len) { case 1: if (regn & BMI160_REG_READ) {