Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v2] dma-buf: fix stale return value documentation for dma_buf_set_name()
  2026-07-30  0:31 [PATCH] " Hung-Chun Tseng
@ 2026-07-30  0:50 ` Hung-Chun Tseng
  0 siblings, 0 replies; 3+ messages in thread
From: Hung-Chun Tseng @ 2026-07-30  0:50 UTC (permalink / raw)
  To: sumit.semwal, christian.koenig
  Cc: linux-media, dri-devel, linaro-mm-sig, linux-kernel,
	Hung-Chun Tseng

Commit e73c317efbf9 ("dma-buf: remove restriction of
IOCTL:DMA_BUF_SET_NAME") removed the dma_resv_lock() and the check on
dmabuf->attachments that returned -EBUSY. It updated the description above
the function accordingly, but left the return value description untouched.

dma_buf_set_name() now returns 0 on success, or the error from
strndup_user(); there is no -EBUSY path left. Update the description to
match the code.

kernel-doc does not validate prose, so scripts/kernel-doc does not report
this.

Fixes: e73c317efbf9 ("dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME")
Signed-off-by: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
---
v2: Add a Fixes: tag identifying the commit that left the return value
    description stale. No change to the diff.

 drivers/dma-buf/dma-buf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index d504c636d..324f4f0c8 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -413,8 +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.
+ * Returns 0 on success, or a negative error code from strndup_user() if the
+ * name cannot be copied in.
  *
  */
 static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] dma-buf: fix stale return value documentation for dma_buf_set_name()
@ 2026-09-01 20:19 Hung-Chun Tseng
  0 siblings, 0 replies; 3+ messages in thread
From: Hung-Chun Tseng @ 2026-09-01 20:19 UTC (permalink / raw)
  To: sumit.semwal, christian.koenig
  Cc: linux-media, dri-devel, linaro-mm-sig, linux-kernel,
	Hung-Chun Tseng

The kernel-doc for dma_buf_set_name() still promises that the function
returns -EBUSY when 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 rewrote the first paragraph of the comment
to match, but left the return value description behind.

The only failure the function can report now comes from strndup_user(),
which is propagated via PTR_ERR(); every other path returns 0. Describe
that instead, using a Return: section so kernel-doc picks it up:
scripts/kernel-doc -none -Wall drivers/dma-buf/dma-buf.c reports "No
description found for return value of 'dma_buf_set_name'" before this
change and is quiet after it.

No functional change.

Fixes: e73c317efbf9 ("dma-buf: remove restriction of IOCTL:DMA_BUF_SET_NAME")
Signed-off-by: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
---
v1 was sent on 2026-07-29 and did not get any review comments.

v1 -> v2:
 - Use a "Return:" section instead of a plain "Returns ..." sentence, so
   kernel-doc actually parses the description (fixes a -Wall warning).
 - Add a Fixes: tag pointing at the commit that removed the -EBUSY path.
 - Widen the Cc list to the dma-buf maintainers, linux-media and
   dri-devel; v1 only went to LKML, which is most likely why it was
   missed.

 drivers/dma-buf/dma-buf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index d504c636dc..6ee3c254d7 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -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)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] dma-buf: fix stale return value documentation for dma_buf_set_name()
@ 2026-09-02 13:59 Hung-Chun Tseng
  0 siblings, 0 replies; 3+ messages in thread
From: Hung-Chun Tseng @ 2026-09-02 13:59 UTC (permalink / raw)
  To: Sumit Semwal, Christian König
  Cc: linux-media, dri-devel, linaro-mm-sig, linux-kernel,
	Hung-Chun Tseng

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")
Signed-off-by: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
---
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/20260730003153.4030818-1-alan.tseng.cs@gmail.com/

 drivers/dma-buf/dma-buf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index d504c636dc..6ee3c254d7 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -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)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-02 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 20:19 [PATCH v2] dma-buf: fix stale return value documentation for dma_buf_set_name() Hung-Chun Tseng
  -- strict thread matches above, loose matches on Subject: below --
2026-09-02 13:59 Hung-Chun Tseng
2026-07-30  0:31 [PATCH] " Hung-Chun Tseng
2026-07-30  0:50 ` [PATCH v2] " Hung-Chun Tseng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox