From patchwork Fri May 5 02:18:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 679846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA372C7EE21 for ; Fri, 5 May 2023 02:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjEECTC (ORCPT ); Thu, 4 May 2023 22:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjEECTC (ORCPT ); Thu, 4 May 2023 22:19:02 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F71A11DBC; Thu, 4 May 2023 19:18:58 -0700 (PDT) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4QCDrc3Hn0z8RTWm; Fri, 5 May 2023 10:18:56 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl1.zte.com.cn with SMTP id 3452IkoU063354; Fri, 5 May 2023 10:18:46 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid31; Fri, 5 May 2023 10:18:47 +0800 (CST) Date: Fri, 5 May 2023 10:18:47 +0800 (CST) X-Zmail-TransId: 2afa645467877be-c82af X-Mailer: Zmail v1.0 Message-ID: <202305051018472856954@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_dma-buf=3A_Use_fdget=28=29?= X-MAIL: mse-fl1.zte.com.cn 3452IkoU063354 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 64546790.001/4QCDrc3Hn0z8RTWm Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Ye Xingchen convert the fget() use to fdget(). Signed-off-by: Ye Xingchen --- 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);