From patchwork Fri Sep 17 08:21:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Wang X-Patchwork-Id: 12501399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D856C433EF for ; Fri, 17 Sep 2021 08:21:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 86B7A6112E for ; Fri, 17 Sep 2021 08:21:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86B7A6112E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0ED7C6B0071; Fri, 17 Sep 2021 04:21:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09DA0900002; Fri, 17 Sep 2021 04:21:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECEC46B0073; Fri, 17 Sep 2021 04:21:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id DF3076B0071 for ; Fri, 17 Sep 2021 04:21:20 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9CA5E824556B for ; Fri, 17 Sep 2021 08:21:20 +0000 (UTC) X-FDA: 78596370720.12.53D90D2 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) by imf20.hostedemail.com (Postfix) with ESMTP id 18035D0000B0 for ; Fri, 17 Sep 2021 08:21:18 +0000 (UTC) Received: from localhost.localdomain (unknown [124.16.141.243]) by APP-05 (Coremail) with SMTP id zQCowABnR6D5T0Rhu_XRAA--.4840S2; Fri, 17 Sep 2021 16:21:14 +0800 (CST) From: Xu Wang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/swapfile: Remove needless request_queue NULL pointer check Date: Fri, 17 Sep 2021 08:21:11 +0000 Message-Id: <20210917082111.33923-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: zQCowABnR6D5T0Rhu_XRAA--.4840S2 X-Coremail-Antispam: 1UD129KBjvdXoWrJFWUWw1ftFWruw1fuw4kJFb_yoWxXFcEvr y0v3ykKrs5Xr13ur13CFyUZasYqFs2qF1xZFWfWFZIqayUGw13JrWDKr98GFW3Z3yjkr1r Cws0kasxJwsrCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4kYjsxI4VWDJwAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I 8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI 64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6xkF7I0En7xvr7AKxVWUJV W8JwAv7VC2z280aVAFwI0_Cr1j6rxdMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0E wIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14 v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkG c2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_ Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU2jXdUU UUU X-Originating-IP: [124.16.141.243] X-CM-SenderInfo: pyxotu46lvutnvoduhdfq/1tbiCgkHA1z4j9xOIgAAsc Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vulab@iscas.ac.cn designates 159.226.251.25 as permitted sender) smtp.mailfrom=vulab@iscas.ac.cn X-Stat-Signature: e9yafie3z46t3579ephn91fse1dfnxe8 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 18035D0000B0 X-HE-Tag: 1631866878-213584 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The request_queue pointer returned from bdev_get_queue() shall never be NULL, so the null check is unnecessary, just remove it. Signed-off-by: Xu Wang Acked-by: David Hildenbrand --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 22d10f713848..42027d213fd2 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3118,7 +3118,7 @@ static bool swap_discardable(struct swap_info_struct *si) { struct request_queue *q = bdev_get_queue(si->bdev); - if (!q || !blk_queue_discard(q)) + if (!blk_queue_discard(q)) return false; return true;