Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3906706imm; Mon, 18 Jun 2018 06:11:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8cibIehEwHDQiMeakkAOaJTVet9Go0bZ+Fzq87kfygc6oD7CHPpEkW9nKl0mDvbHfzx49 X-Received: by 2002:a62:5601:: with SMTP id k1-v6mr13536496pfb.212.1529327479374; Mon, 18 Jun 2018 06:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529327479; cv=none; d=google.com; s=arc-20160816; b=L899kOxcPcRDsv3BW+XYiMGEAvd8w8KtNYAn5KfSjL0CSr6M/qU1q4niT23LwEajmM ZcLkrREFJW61pqo+UVoq8SBSWlLrstDSvvjfFc2YUxpIuH7NckCvziech5Ku/n1L1+6b uULkTkaqRA2BO78e44hjfRXIps6jyglv/k+wXJbpoHV12enl+p3ANLTrUk7UbAqG94bi ak68xNAC+q73iB1Qa5JwCkkqaH9z0XAacrsPlpfRXUi/+uME+xv3AT0cYIwgwjfLxJet 8Xl+sW+Lgl9XtDmZdrITNNSjbZNbMqUqtHRKNpoZFbfd0VHNkZkR1HYzvSxPcP7GKx+v zLLw== 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=sOqpYe/1ou7mCsxtmEqiLynL7Yj0UUiN/ZAD6/VkkT/45FJuvkAhgtn9vd6G0H6Cj+ VbGZ0iRhb1OJ9IYqY/dq3mjnpAmJz7Qcmhjh+8x7ZSJFKdVpe39NkWrfLQ6Z8pfF40rF rbBGb5AyGOG6U4jZU51JrFvjb9MmYyXhNGhnas7Aht2sslXipRBhqt/DNyaDV0rl7MbW XKyBErmF+Z1ReaVsP0wJ8y3Zc9L2L9dJeXiNvn/abwOY10/DyPRxB0SD/vRJd6ocNAH8 joIy+FmttL/gCUJCA4bBky8Gcw96o0GLk5WlgnjFu3yXcY+EbLH/92gPgZtkFlV8RItA edQg== 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 b66-v6si14468453pfe.265.2018.06.18.06.11.04; Mon, 18 Jun 2018 06:11:19 -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 S933957AbeFRNKL (ORCPT + 99 others); Mon, 18 Jun 2018 09:10:11 -0400 Received: from mga05.intel.com ([192.55.52.43]:57985 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932657AbeFRNKH (ORCPT ); Mon, 18 Jun 2018 09:10:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 06:10:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,239,1526367600"; d="scan'208";a="50219609" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 18 Jun 2018 06:10:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 77CF9124; Mon, 18 Jun 2018 16:10:04 +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, Joe Perches Cc: Andy Shevchenko Subject: [PATCH v3 2/5] bitmap: Drop unnecessary 0 check for u32 array operations Date: Mon, 18 Jun 2018 16:10:00 +0300 Message-Id: <20180618131003.88110-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618131003.88110-1-andriy.shevchenko@linux.intel.com> References: <20180618131003.88110-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