Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4983710iob; Mon, 9 May 2022 06:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx46CxM2gH+phtQ/Ll+iV0pXw6MyekQRVE0R/JkH8DdJ37iPUHf3Gv4hdgw1VGvjJWmlKXq X-Received: by 2002:a17:90a:ee96:b0:1dc:6680:6f2d with SMTP id i22-20020a17090aee9600b001dc66806f2dmr18079181pjz.174.1652102257836; Mon, 09 May 2022 06:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652102257; cv=none; d=google.com; s=arc-20160816; b=nshMyAxZEEtJxtzClVxdKBmqHD7dBsMulDDEvnTyODYULqwhHnyyPrAc7V0RbwN/cQ jRj7RmM6ALqaEjANalxB5wyABtQojO9AgW4CLkqjefnGK0HG0VQRov0/J4qg0fXhUDQf 5T8/AjxQiPDY9T3IG1zSMSn3G8djc2+yk1YPdOuiB1vIk5CJuLEGBiIAVri7BpQXexOs 4CL8Rvov87/wxmCxW5mmO4qqiSdTiW50ILCete5fTVjglwjspVHSqCJ7Ed6hJQtgTxX8 SlZ2UP+/m8CljioH5qdrrOEE5iOs0jetLlHW5kvPkIk1JtjgJ45a0K0zwRnE9D5t4xMA 4Azw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Cwa2r2FRFwiyd1qP/LRuMqZbccrTer4X37bVhub1LGc=; b=wrautZbw399ACaBcpn9M4BiaHMwZDsB2CZ8XU3ejFDDP39wcHL92+2GqMSyM9L5RZq 4H4cmg515HsCJkEtZf+V3GXAZBLh470toMPVKAgUo4SoJ2gCCP8WhM9sCtrzSLDKKPV9 eHaWWTl74UASoDcz7ICSyl13rSrGSS+nGOnlywSbeM7gPnJ6AUDWnlEo9LwNop1SpCi1 Xy3zagClJT9y3/1mEIRUZBkswYcsKJKG2z62aKKDJCmhdECBJq9kPkWgCMyuasZQt/oz RUI5X+nq72sxX2Jlmg1SZnBDUMknALO6x0fU5KDywzW99UGkCo8jCOHF9vD5RnZM4Ebl gC3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u5-20020a170903124500b0015ebbb0a3desi13720264plh.52.2022.05.09.06.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 280071A44A7; Mon, 9 May 2022 06:15:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235365AbiEINSu (ORCPT + 99 others); Mon, 9 May 2022 09:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbiEINSF (ORCPT ); Mon, 9 May 2022 09:18:05 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DC52A8048 for ; Mon, 9 May 2022 06:14:10 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KxhST18KrzhZ41; Mon, 9 May 2022 21:13:29 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 9 May 2022 21:14:03 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , Subject: [PATCH 07/15] mm/swap: remove unneeded p != NULL check in __swap_duplicate Date: Mon, 9 May 2022 21:14:08 +0800 Message-ID: <20220509131416.17553-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220509131416.17553-1-linmiaohe@huawei.com> References: <20220509131416.17553-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If p is NULL, __swap_duplicate will already return -EINVAL. So if we reach here, p must be non-NULL. Signed-off-by: Miaohe Lin --- mm/swapfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index d4b81ca887c0..7b4c99ca2aea 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3336,8 +3336,7 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage) unlock_out: unlock_cluster_or_swap_info(p, ci); - if (p) - put_swap_device(p); + put_swap_device(p); return err; } -- 2.23.0