Skip to content

Commit

Permalink
local-dmabuf: only set dmabuf_supported in the end
Browse files Browse the repository at this point in the history
We were setting dmabuf_supported to true before calling
IIO_DMABUF_ATTACH_IOCTL that can still fail. Thererefore we would be
wrongly using the DMABUF interface for things like enqueue/dequeue
blocks.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
  • Loading branch information
nunojsa authored and cristina-suteu committed Sep 27, 2024
1 parent 9485e10 commit 9f24ce5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion local-dmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 9f24ce5

Please sign in to comment.