From patchwork Tue Jan 24 00:02:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 47471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1881764wrn; Mon, 23 Jan 2023 16:09:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMO/yRc+wDKJb2cAPNfwR/cVyrbKa+/4alkX0tZHkC04DDiv3VV85n4nM5p2T4U3tbRhjH X-Received: by 2002:a17:906:7e14:b0:86e:2c11:9bce with SMTP id e20-20020a1709067e1400b0086e2c119bcemr27707102ejr.38.1674518953172; Mon, 23 Jan 2023 16:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674518953; cv=none; d=google.com; s=arc-20160816; b=d84F/BQSnWtkDn1QwqqvPD3eF31nyvVSvP+hMqgbwrlnlM8+XglHVydM8nCflh8fXd Ca2SmNuGQPmACM9YMUOKy4cy5sjh8VbONf2v78oIEOmXIResaJh56lwiT1PDyRAnMyBV Cabev2wU7XfIVpngSm642OF108VTRfvv6LiaKomPQ7kl6+CERKRttZH5AZh2thelJkyo dL3lAm8cY2722MORrfC27bWsXnUEVzpvYYddxGy6es6kHYEh2q1jTf6AGztla4hZISZi SyXTfrRkGmovNJX0DRyPpJ/o568DukY9p+1G+TwqzgCwrcm3knNp8JcdO1cRoOUG8HnY 7A2g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Viudg6MoejX0l+blH0qOsZmA3H+aCmAXY+dSPMYU12A=; b=hkPmsTbd8lMZaGkOlka6Zq7ChEYhVFbVAPIDN9JPerigT9mkjkpLQEUXJrC6GWIPOX TWhSTrDoQCceL8PUlSzBE4HKZl/PcF6pFZDIe2LZZi+zXHn3wJ8s/28c8tfH3FXAJL4S O6khfCMRfF1uXWrcbhC/xHVn9M/65nxJfx0dXINgCZ0VTy617pL1cqvJQguUzv/JC+O5 csau8E4aeWCONJ9QhZ5Lni8ibTSJmV75q3MSFMMebRC2/DYiKXjD5vfMiD9VWnLNry75 FyazjfqilK4a8TOhxBzHWM+ZU4ZJhJfWAc3+CC1kKVWWCOJUfEwrvDOX/I87vZmfonxi OCgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xliz6UEp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a170906004100b0084d1a2c5a0asi314714ejg.937.2023.01.23.16.08.48; Mon, 23 Jan 2023 16:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xliz6UEp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbjAXADu (ORCPT + 99 others); Mon, 23 Jan 2023 19:03:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbjAXADr (ORCPT ); Mon, 23 Jan 2023 19:03:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE8B83C4 for ; Mon, 23 Jan 2023 16:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674518574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Viudg6MoejX0l+blH0qOsZmA3H+aCmAXY+dSPMYU12A=; b=Xliz6UEplvRqSrCfqt4+pEnG1+X4pO/qPvBYaboSIiT6Y2xmHaNFVjM/t6wbyI6f00rc5A kzibmE+IeCOBPlWnCMLoQwzf4U/BZ8/ZkwOfk2S48Fc1iFhmb6lOsIXRxtVlhNLJMGGGfO +4WbitzoROUCuDMVSQZoSph3RQG6b1k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-192-ts3hbKqWPQ-brZHtcxct8g-1; Mon, 23 Jan 2023 19:02:50 -0500 X-MC-Unique: ts3hbKqWPQ-brZHtcxct8g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F4D1802BF3; Tue, 24 Jan 2023 00:02:50 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-98.bne.redhat.com [10.64.54.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 157142166B32; Tue, 24 Jan 2023 00:02:47 +0000 (UTC) From: Gavin Shan To: linux-kernel@vger.kernel.org Cc: yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, shan.gavin@gmail.com Subject: [PATCH] nodemask: Drop duplicate check in for_each_node_mask() Date: Tue, 24 Jan 2023 08:02:43 +0800 Message-Id: <20230124000243.415621-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755860385704678257?= X-GMAIL-MSGID: =?utf-8?q?1755860385704678257?= The return value type is changed from 'int' to 'unsigned int' since commit 0dfe54071d7c8 ("nodemask: Fix return values to be unsigned"). Besides, the conversion between 'int' and 'unsigned int' on the parameter @node is guaranteed to be safe due to the limited range of MAX_NUMNODES and CONFIG_NODES_SHIFT. By the way, '(node >= 0)' should have been '(node) >= 0' actually. It's unnecessary to check if their return values are greater or equal to 0 in for_each_node_mask(). Remove it. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Andy Shevchenko --- include/linux/nodemask.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index bb0ee80526b2..8d07116caaf1 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -385,7 +385,7 @@ static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp, #if MAX_NUMNODES > 1 #define for_each_node_mask(node, mask) \ for ((node) = first_node(mask); \ - (node >= 0) && (node) < MAX_NUMNODES; \ + (node) < MAX_NUMNODES; \ (node) = next_node((node), (mask))) #else /* MAX_NUMNODES == 1 */ #define for_each_node_mask(node, mask) \