Skip to contentSkip to conversation

dma-buf: fix stale return value documentation for dma_buf_set_name()

PATCH In review Hung-Chun Tseng 1 participant 2 messages Sep 2 – Oct 17

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dma-buf: fix stale return value documentation for dma_buf_set_name()

The kernel-doc for dma_buf_set_name() still documents an -EBUSY return for the case where the dma-buf is already attached to devices:

Returns 0 on success. If the dma-buf buffer is already attached to devices, return -EBUSY.

That has not been true since commit e73c317efbf9 ("dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME"), which dropped the dma_resv_lock() and the !list_empty(&dmabuf->attachments) check that produced -EBUSY. That commit updated the description paragraph above, but left the return value description behind.

The only failure the function can report now comes from strndup_user(), propagated via PTR_ERR(); every other path returns 0. Document that instead, using a Return: section so kernel-doc picks it up.

No functional change.

Fixes e73c317efbf9 ("dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME")

---
Changes in v2:
- Use a "Return:" section so kernel-doc actually parses the return value description; scripts/kernel-doc -none -Wall reported "No description found for return value of 'dma_buf_set_name'" before this change and is quiet after it.
- Reference the commit that made the -EBUSY text stale, and add a
Fixes: tag for it.
- Resend to the dma-buf maintainers and dri-devel; v1 only reached linux-media, where it was marked "Not Applicable".

v1: https://lore.kernel.org/linux-media/[email protected]/

 drivers/dma-buf/dma-buf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/dma-buf/dma-buf.c +2 -3
index d504c636dc..6ee3c254d7 100644
@@ -413,9 +413,8 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
  * @buf:    [in]     A piece of userspace memory that contains the name of
  *                   the dma-buf.
  *
- * Returns 0 on success. If the dma-buf buffer is already attached to
- * devices, return -EBUSY.
- *
+ * Return: 0 on success, or a negative error code from strndup_user() on
+ * failure.
  */
 static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf)
 {
Signature · 1 line
2.43.0
#1 lore raw

Hi Sumit, Christian,

Gentle ping on this one. It still applies cleanly to next-20261016, where the comment still documents the -EBUSY return that commit e73c317efbf9 ("dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME") removed.

Sorry for the noise around v2: it went out three times (2026-07-30, 2026-09-01 and 2026-09-02) while I was sorting out the recipients. This posting from 2026-09-02 is the one to look at; the others can be dropped.

Thanks,
Hung-Chun