mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dma-buf: Use fdget()
@ 2023-05-05  2:18 ye.xingchen
  2023-05-11  5:43 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2023-05-05  2:18 UTC (permalink / raw)
  To: sumit.semwal
  Cc: christian.koenig, linux-media, dri-devel, linaro-mm-sig, linux-kernel

From: Ye Xingchen <ye.xingchen@zte.com.cn>

convert the fget() use to fdget().

Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
---
 drivers/dma-buf/dma-buf.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index aa4ea8530cb3..bf4980b6f80c 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -729,19 +729,17 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_fd, DMA_BUF);
  */
 struct dma_buf *dma_buf_get(int fd)
 {
-	struct file *file;
-
-	file = fget(fd);
+	struct fd f = fdget(fd);

-	if (!file)
+	if (!f.file)
 		return ERR_PTR(-EBADF);

-	if (!is_dma_buf_file(file)) {
-		fput(file);
+	if (!is_dma_buf_file(f.file)) {
+		fdput(f);
 		return ERR_PTR(-EINVAL);
 	}

-	return file->private_data;
+	return f.file->private_data;
 }
 EXPORT_SYMBOL_NS_GPL(dma_buf_get, DMA_BUF);

-- 
2.25.

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

end of thread, other threads:[~2023-05-11  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05  2:18 [PATCH] dma-buf: Use fdget() ye.xingchen
2023-05-11  5:43 ` Al Viro

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

all inboxes | Powered by JetHome®