From 4a98e5dc8ee13ff478e68149b2fc1e603c7756a5 Mon Sep 17 00:00:00 2001 From: Mirko Becker Date: Wed, 9 Oct 2024 09:29:20 +0200 Subject: [PATCH] sensor: fix assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With rtio_sqe_prep_read() buf is assigned to userdata. The __ASSERT should check if the same userdata arrived with rtio_cqe_consume_block()$ (cherry picked from commit 4d4938fa2e1dec52430b60a7a864811316335dae) Original-Signed-off-by: Mirko Becker GitOrigin-RevId: 4d4938fa2e1dec52430b60a7a864811316335dae Cr-Build-Id: 8733565196572304993 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8733565196572304993 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: Ic9386e5bedc95126ff8a80c85f5ff35013999b23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5942570 Tested-by: Ting Shen Reviewed-by: Ting Shen Reviewed-by: Fabio Baltieri Commit-Queue: Ting Shen Reviewed-by: Dawid Niedźwiecki --- include/zephyr/drivers/sensor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/drivers/sensor.h b/include/zephyr/drivers/sensor.h index e16144faae8..1d958a4b707 100644 --- a/include/zephyr/drivers/sensor.h +++ b/include/zephyr/drivers/sensor.h @@ -1064,7 +1064,7 @@ static inline int sensor_read(struct rtio_iodev *iodev, struct rtio *ctx, uint8_ struct rtio_cqe *cqe = rtio_cqe_consume_block(ctx); int res = cqe->result; - __ASSERT(cqe->userdata != buf, + __ASSERT(cqe->userdata == buf, "consumed non-matching completion for sensor read into buffer %p\n", buf); rtio_cqe_release(ctx, cqe);