Message ID | 20181123222811.18216-1-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3D8C14BD for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 23 Nov 2018 22:28:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8498C2A8C0 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 23 Nov 2018 22:28:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 760F42A8C5; Fri, 23 Nov 2018 22:28:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D22D2A8C0 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 23 Nov 2018 22:28:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 283DB6B332C; Fri, 23 Nov 2018 17:28:44 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 20C3A6B332D; Fri, 23 Nov 2018 17:28:44 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ADC36B332E; Fri, 23 Nov 2018 17:28:44 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id BC51E6B332C for <linux-mm@kvack.org>; Fri, 23 Nov 2018 17:28:43 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id a72-v6so5906016pfj.14 for <linux-mm@kvack.org>; Fri, 23 Nov 2018 14:28:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=8gTioXrfb1hYx42mMThFJ6Ee2wmmeYe6sGLfcA6NCF4=; b=T4q2c8sMNhOVCOx+5ZljzUGBDwKtvN+izRBHRd0sjExk+t9ngwuEbpjk0sUFlQ77HP dEsUr5rAGKOIzXa2XDLOtLdV2aH/+RyZoBgIUTMFsAqBz58p21Vpq1xv8R4SdEmfoGSF uHEJ+io6jcsKdmdvsPYC+0AoUFwaA0CPV13gN9vdnHoLreeyZnprhy8GRXTQApJonvKY YZndIyFCM9iMGkc+jkHBRolhgI5tsDj6QOWTkW8HW6yUm+/sHBQFe+IRP/PlJmst47dC MzAfcRqfw6twd5JD0W1GFOFXp3oYwKdvRuKbjzVajSbfp+0k65LNWPj0x320efH/p4H9 d+Ww== X-Gm-Message-State: AA+aEWY2sfQYap27yxcSVvqtoi0Q6q4wQfojpuP0A/5G1qCk15NqF6FB 6M4TUfP74eQwjbRVOFvqAlseclHkZQClbPAUkJJfIlQaACmri/Y00VNLm6im3+kRPUoYqTvizJL xo/hWuUHBwc/+O+GetlLDUCjnz9L9GGF/qNkGyuBdmLjFaXrcCwhTwsq8bneiC5neJjcD79VSEL 9bFtpqciOePZSC5hn8KwoK6T/A/tX8ghh+B0P+f1mR1WWH9JKJOWBIjzmUu8f+mCGID1zaxaF4g f68oQreqoj2MQbEn8fNY7AtmkmkyRHHv1KDhlkXb3o1kFfLKlqksxZ1OvcEqoyAAqP6fb4axcy9 MFAokOeR0+QVkNsjFkKMBs7jYh8J91kn2kiQBynXdMUaJt5nmr3GZi4GZdcdHvagf6mb5C3H5LB R X-Received: by 2002:a17:902:ac8f:: with SMTP id h15mr16985258plr.245.1543012123201; Fri, 23 Nov 2018 14:28:43 -0800 (PST) X-Received: by 2002:a17:902:ac8f:: with SMTP id h15mr16985235plr.245.1543012122362; Fri, 23 Nov 2018 14:28:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543012122; cv=none; d=google.com; s=arc-20160816; b=Z29YbrhPmTxwAc7inSrXv03fvxoPa1IW71o+t4FRK5AVUhsXCjbTr1lJtjjZdw2JVy wIs+p3+IwfqCDrKP4QAoqsinIxjVDGcIMBhopXk8rFR/ykaPnQOBzMcoufJkY8IeR3kr pXsCKAV2L/mJ7BrlZoVRutzQuke8iU0qD349fl4c0muhc+dEAAXmiAigTN7gZ+9Wf9uF lPDdCKErHTg421ZgtZbjZcOpkM07vGS96ZLi6Tdv5xeeig/crBPW1tTVXJIqxWE0GjKu eF+0rOX5ucnqOAPbe2sRT9potPJgGcHAwIZifTgDxyq5m3tSoVEE2Zc7VMhHiHTmMoFm xs8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=8gTioXrfb1hYx42mMThFJ6Ee2wmmeYe6sGLfcA6NCF4=; b=yIhilflsfLuB95xV435DNcpTwxHvvjzjtvQoO/CgNzEh4X89bJlF4wfWltI4Oloj+j CcVK5dka9YRxt6bovBrmZuUhSUYPC/6tm9k32+sCJ4cSRyeNB3Eb/e1V/Mv8wTuRsA7E Ouf86VHoPr/szLLDO9f4YeKkQ8gnLCVn7KHqd1LGOWCxTPYapoRRpVlZ8i7DVyxsS7uT pEuXMquxc9Z7feM+AmXUxhX/GNZqDWq4B3yixqT1BdQuBKnkMdYb4pQEdf8iq3UpmCLi ej9KtlBjQBc80PpvpEfzS6t4FTuOrEoOf4H9TFtLPOolEvLnY5Y9cnJOEw/E5Iwnd/hw buuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vYewTL9Q; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id i63sor63780418pge.62.2018.11.23.14.28.42 for <linux-mm@kvack.org> (Google Transport Security); Fri, 23 Nov 2018 14:28:42 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vYewTL9Q; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8gTioXrfb1hYx42mMThFJ6Ee2wmmeYe6sGLfcA6NCF4=; b=vYewTL9QPPafvi2N1eOi2z6a7zFe8Yg9JWNZcpCtrzsUraWPrdjOkzqwX0gT4bPlKU E0rlwiyLrEznbQHhO8N6wKfS4bgpKwJryVgANrwjSkt9nBOfqKj8pibDcx6G5og6ajba 9HFUrT2bHrRR747kAK/yMhoEXZOF47lgG/PT3BCwZcjVUs54ZtVkzM1b6Gy56Vn79w08 Ld7KwFqcIO1mXAX/DhqwrShLsG7YoUCgKyTdYOW2kFdajqWBuevZe62J6nytMwQqhjfi MUlYi+JaQkWJxVe7AssVoEoF53jRakIIL2MjetM50R8gPcElF+HPFv8bZ9P9TZpogkHf eHeA== X-Google-Smtp-Source: AFSGD/U49Tpwi4lMf1SUIy0yi7S9z4NRrp4MEWgcW1RyA91zkUkX/pEXnCDHoj6aaalZKEeBPKD4ew== X-Received: by 2002:a63:ea4f:: with SMTP id l15mr15498659pgk.102.1543012121902; Fri, 23 Nov 2018 14:28:41 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id e64-v6sm41919903pfc.122.2018.11.23.14.28.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 14:28:41 -0800 (PST) From: Wei Yang <richard.weiyang@gmail.com> To: gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang <richard.weiyang@gmail.com> Subject: [PATCH] drivers/base/memory.c: remove an unnecessary check on NR_MEM_SECTIONS Date: Sat, 24 Nov 2018 06:28:11 +0800 Message-Id: <20181123222811.18216-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 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: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
drivers/base/memory.c: remove an unnecessary check on NR_MEM_SECTIONS
|
expand
|
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 0e5985682642..547997a2249b 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -688,7 +688,7 @@ static int add_memory_block(int base_section_nr) int i, ret, section_count = 0, section_nr; for (i = base_section_nr; - (i < base_section_nr + sections_per_block) && i < NR_MEM_SECTIONS; + i < base_section_nr + sections_per_block; i++) { if (!present_section_nr(i)) continue;
In commit cb5e39b8038b ("drivers: base: refactor add_memory_section() to add_memory_block()"), add_memory_block() is introduced, which is only invoked in memory_dev_init(). When combine these two loops in memory_dev_init() and add_memory_block(), they looks like this: for (i = 0; i < NR_MEM_SECTIONS; i += sections_per_block) for (j = i; (j < i + sections_per_block) && j < NR_MEM_SECTIONS; j++) Since it is sure (i < NR_MEM_SECTIONS) and j sits in its own memory block, the check of (j < NR_MEM_SECTIONS) is not necessary. This patch just removes this check. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> --- drivers/base/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)