From 3d7ad71edc0cf23e6e46ac4915a2f161e25b51db Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Wed, 7 Aug 2024 09:33:09 +0200 Subject: [PATCH] local-dmabuf: only set dmabuf_supported in the end We were setting dmabuf_supported to true before calling the IIO_DMABUF_ATTACH_IOCTL that can still fail. Thererefore we would be wrongly using the DMABUF interface fir things like enqueue/dequeue blocks. Signed-off-by: Nuno Sa --- local-dmabuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/local-dmabuf.c b/local-dmabuf.c index a453803d5..1b5f1414e 100644 --- a/local-dmabuf.c +++ b/local-dmabuf.c @@ -115,7 +115,6 @@ local_create_dmabuf(struct iio_buffer_pdata *pdata, size_t size, void **data) priv->size = size; priv->buf = pdata; priv->dequeued = true; - pdata->dmabuf_supported = true; /* The new block is dequeued by default, so enable CPU access */ ret = enable_cpu_access(priv, true); @@ -136,6 +135,8 @@ local_create_dmabuf(struct iio_buffer_pdata *pdata, size_t size, void **data) goto err_data_unmap; } + pdata->dmabuf_supported = true; + close(devfd); return priv;