Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp602522imm; Thu, 31 May 2018 06:20:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKhbmX/iZgbM3xB5TtXLnNGFIvxq4KuMyPvcxm6KFbWQY5N7CFc1nNuc+8nYJif3LgJp/RH X-Received: by 2002:a63:82c7:: with SMTP id w190-v6mr5549235pgd.172.1527772824805; Thu, 31 May 2018 06:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527772824; cv=none; d=google.com; s=arc-20160816; b=aShBxbkvotnQcYN0c9r4zObKL8URsAf5H6NX/UBE/jjXOOJSLX38Gybc8husGIJq7G FwCWFS5oPdUr/syRkP6fo5QHe39yZR2KJC2JHJvIPSgzavgKXHTgowYyFVrFVO+Nfvr+ owvry7ZFWO1OxdWIdoO2H4Xdfw2En9oQBEx6jEBVjsFzohrSXDE64ir5RFLQDpxf2+1c vV/6PsHtoMAEO2FYF02gFZZyZldIj1pFZn8x/vaQ/BHKz7K08ysPdh67dgZkro3jIo95 01saFsGDtyY2E6bJ3EieOE+qlHilflGEenhkD2ktafn9H0rsuPx/gdk8AhXUeAhIFZWp 46/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7U5fJlRDukEDwM+e0D4UooSKib2oFHqj+DbEfepEQ8w=; b=ivsG3m8D1KpHDTFzBqfY7q84E8DOt6F1fu2PS1UUcnU9jDbPzew+qr5To0v4LwOlU0 u1U6Y0wn68z3RKOPkjRDgsMZcWxQBtCAusk6xXbKBIIXB1zI4yZA19xW919AJSo7tNcF i4aQWjFu1y9OHpXjRSIHV69/KYPt7oLcPJBuMuglIMRZBWylQoTyG/dyz/FY5p+lXvNd jSsQT0iFaJ6Cbv6+U73hq0ME0/1vqq6oEw8m8sDKJ4UCiAOwYnNm4qp56LAcMAk1zSne m+jh00G2m0J7V82NCx+2mh19BncyRNbNELDRGGGYp48Wy8realKL8SnytRtyzYNfm2Qc 0hvA== 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 189-v6si11070140pfy.293.2018.05.31.06.20.09; Thu, 31 May 2018 06:20:24 -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 S1755093AbeEaNTU (ORCPT + 99 others); Thu, 31 May 2018 09:19:20 -0400 Received: from mga01.intel.com ([192.55.52.88]:2912 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820AbeEaNTS (ORCPT ); Thu, 31 May 2018 09:19:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2018 06:19:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,463,1520924400"; d="scan'208";a="52276706" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 31 May 2018 06:19:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3DD96E3; Thu, 31 May 2018 16:19:15 +0300 (EEST) From: Andy Shevchenko To: Andrew Morton , linux-kernel@vger.kernel.org, Yury Norov Cc: Andy Shevchenko Subject: [PATCH v1] bitmap: Drop unnecessary 0 check for u32 array operations Date: Thu, 31 May 2018 16:19:14 +0300 Message-Id: <20180531131914.44352-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.0 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(). 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.0