Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp788879imm; Fri, 15 Jun 2018 06:21:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLi6DT8PmIITpPPOPqODs1fhJHaE5j6wuv3FMTwQRgW/WxKqVDHEgT7eRCPnOQy6QUBYBoB X-Received: by 2002:a62:221a:: with SMTP id i26-v6mr1968788pfi.240.1529068866847; Fri, 15 Jun 2018 06:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529068866; cv=none; d=google.com; s=arc-20160816; b=nRhdpHeXOC34Zny1k3m6s2PcyGvqJ69M4CKFszH8J1Um4air//bD7BMCw16/1IWI0s dxLuBhfyd3PfzuwVlFCIHl+Sp9qQQRWW/vxBR147qWGprsa+oiUnj6w/+Xnv/BNUOUPA BewhPDfIBjlF1YUQzmrTmx44GnYxB5h1j+Wa7YQTMPxfDV8jds9nIKR26YUbjQNekNFx nnayIH4BxK6yGowzxRgT76rUAaEuCTOpKoJfLa76Y6BuUNzLq8D0Y2ScX9K/F/VWVKqo z/Mo8JSnDDv+jJDyjjbgAfIm5/bueKUfMfezLMr4q5KecRM732IRmcKcFnL4pT4ehQtV bQHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rm1zluSGKYLQptw5DSNGyGYkOLwj/9f8dL6+qgvjpSA=; b=k/V2lcd3l+J7CxCnAp0zBjtrZ+mzcnCWhENssmcw5c/+BydpL7yHpo7+vifaA4lzCK 7Ce6gvjOhLxb/USNv2Uxh9IZ0oRO2mSgxU02f0/knifNp12jfwwRP2ZDGvliohmPoEiU Da6fxNWqxsf03le4FmSBMM6Q3H4nkYjmaYFmmaBtIYx5PaJe2eaZ79nZa6xwmR91IeQU MFryhj3p5LkZtCwqv6QemfBqEcugrRbnzEq4SjuHmPDxUM3Chx7sTUUhpgNmU1ubw0ZE ovvyCY8FKpDv44jbcN1igLSRR/V6qeOZ7rf36r/CZ7FKMFyApc3niYCft3fV2aNbBvBG CiKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14-v6si7891766plq.41.2018.06.15.06.20.52; Fri, 15 Jun 2018 06:21:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965737AbeFONUY (ORCPT + 99 others); Fri, 15 Jun 2018 09:20:24 -0400 Received: from mga11.intel.com ([192.55.52.93]:14574 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936195AbeFONUV (ORCPT ); Fri, 15 Jun 2018 09:20:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2018 06:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,227,1526367600"; d="scan'208";a="64399403" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2018 06:20:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 55085300; Fri, 15 Jun 2018 16:20:18 +0300 (EEST) From: Andy Shevchenko To: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Shaohua Li , linux-raid@vger.kernel.org, Dmitry Torokhov , linux-input@vger.kernel.org, Andrew Morton , Yury Norov , linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com Cc: Andy Shevchenko Subject: [PATCH v2 2/5] bitmap: Drop unnecessary 0 check for u32 array operations Date: Fri, 15 Jun 2018 16:20:14 +0300 Message-Id: <20180615132017.23889-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615132017.23889-1-andriy.shevchenko@linux.intel.com> References: <20180615132017.23889-1-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nbits == 0 is safe to be supplied to the function body, so, remove unnecessary checks in bitmap_to_arr32() and bitmap_from_arr32(). Acked-by: Yury Norov Signed-off-by: Andy Shevchenko --- lib/bitmap.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index 58f9750e49c6..33e95cd359a2 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -1132,14 +1132,10 @@ EXPORT_SYMBOL(bitmap_copy_le); * @buf: array of u32 (in host byte order), the source bitmap * @nbits: number of bits in @bitmap */ -void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, - unsigned int nbits) +void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, unsigned int nbits) { unsigned int i, halfwords; - if (!nbits) - return; - halfwords = DIV_ROUND_UP(nbits, 32); for (i = 0; i < halfwords; i++) { bitmap[i/2] = (unsigned long) buf[i]; @@ -1163,9 +1159,6 @@ void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, unsigned int nbits) { unsigned int i, halfwords; - if (!nbits) - return; - halfwords = DIV_ROUND_UP(nbits, 32); for (i = 0; i < halfwords; i++) { buf[i] = (u32) (bitmap[i/2] & UINT_MAX); -- 2.17.1