From patchwork Thu Jan 19 21:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 13108861 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 83A55C004D4 for ; Thu, 19 Jan 2023 22:03:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjASWDU (ORCPT ); Thu, 19 Jan 2023 17:03:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbjASWCs (ORCPT ); Thu, 19 Jan 2023 17:02:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F70159565 for ; Thu, 19 Jan 2023 13:40:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73D2461D91 for ; Thu, 19 Jan 2023 21:40:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9AF2C433F2; Thu, 19 Jan 2023 21:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674164428; bh=cTUelAc/uEnB+p0V7+95YgbegMhVccETAc/DBIf3sS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uz8qQwcqt1Cbmvrz+oWzpYodP34XtK8KMSfFhzMfXtG9XcDknULAilFRU3iiuVpDg pTo0fUxvrSdMv2lmIhncAh02sNBRMVjlrDrhWttw6uXtQObJsdgv5N4AZenbgyweA8 cFmuu6/j9Mi7LkTmKCaqYemHVPfNx7lXnaeRHAEXRsc5UBXCMRV3qtuAExajdLYzg3 8IkFnuFijnH6OseNjRY5wiY/ukyNvBC2Vg6JrVSW4+ZdWg621rnpDiQ0lqn5zF9ErT dO+/138W1FIgSS0KFe110SGNVIoVlqXvlE6uBmVKkI1XWWhNgnfe4lud0V3nGRoWL4 PF6z6bFGhS/fA== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 18/18] NFS: Remove unnecessary check in nfs_read_folio() Date: Thu, 19 Jan 2023 16:33:51 -0500 Message-Id: <20230119213351.443388-19-trondmy@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119213351.443388-18-trondmy@kernel.org> References: <20230119213351.443388-1-trondmy@kernel.org> <20230119213351.443388-2-trondmy@kernel.org> <20230119213351.443388-3-trondmy@kernel.org> <20230119213351.443388-4-trondmy@kernel.org> <20230119213351.443388-5-trondmy@kernel.org> <20230119213351.443388-6-trondmy@kernel.org> <20230119213351.443388-7-trondmy@kernel.org> <20230119213351.443388-8-trondmy@kernel.org> <20230119213351.443388-9-trondmy@kernel.org> <20230119213351.443388-10-trondmy@kernel.org> <20230119213351.443388-11-trondmy@kernel.org> <20230119213351.443388-12-trondmy@kernel.org> <20230119213351.443388-13-trondmy@kernel.org> <20230119213351.443388-14-trondmy@kernel.org> <20230119213351.443388-15-trondmy@kernel.org> <20230119213351.443388-16-trondmy@kernel.org> <20230119213351.443388-17-trondmy@kernel.org> <20230119213351.443388-18-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust All the callers are expected to supply a valid struct file argument, so there is no need for the NULL check. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Trond Myklebust --- fs/nfs/read.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index bf4154f9b48c..c380cff4108e 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -355,13 +355,7 @@ int nfs_read_folio(struct file *file, struct folio *folio) if (NFS_STALE(inode)) goto out_unlock; - if (file == NULL) { - ret = -EBADF; - desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ); - if (desc.ctx == NULL) - goto out_unlock; - } else - desc.ctx = get_nfs_open_context(nfs_file_open_context(file)); + desc.ctx = get_nfs_open_context(nfs_file_open_context(file)); xchg(&desc.ctx->error, 0); nfs_pageio_init_read(&desc.pgio, inode, false,