Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp692241imm; Thu, 31 May 2018 07:48:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLe1bCan8O1sOd7s1kr2/O4r6l4o/WSjTTaxu5GVsBIVyO00DAlVnwZZW8vJdeVOJQ/PExO X-Received: by 2002:a17:902:41:: with SMTP id 59-v6mr7379561pla.345.1527778126370; Thu, 31 May 2018 07:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527778126; cv=none; d=google.com; s=arc-20160816; b=p2naS5eYLAdzK8uXNfXwtSvf5YTbshPL1REm5k460Hmtx4BeLu6FcJvDL5Cywpn/yh fLbSxFhjBTTEZ1IlnplBbrJ5XsyZFyv6ZyJukGv692drCwU94kLKYsz1Sw11sfeHVuiq XsPbrJH4XkzihaK89E/FL0UOvMyCYUOw1e4cuEJ8Xzm1foguiTuMQaznqmSE6xTN2OHa m0hGrZ52WU8TcYILd5OqTSDGjjUXcMFBm0xvgHVeIDVR+rRZMesRb0aOD7UPCmLvKmXe tLJlHUImKEfzNl7v/qFmvWqC8mZkMZBkRp5pW30mtuX5jBv1kBBBiVMS8Lg49AG0OcR9 C7LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=ZalAKasY+Dw2vmEYIln4QPOScdKI7J7eidyknqhKtY4=; b=DruZldI2uw14MjRevbZNjMPEoaiCGKNOlYcvjbUF4wvtJMbI4wpfsMUbbv1Z2eemTh xY+MW1jsR0crNJ27VifTbEfDGfyPQECRJ4qvz4XD8Na1DJsVjM5mIliFfQDCJ1WTtqm+ P71kIn+guvWcoa68TwwDDstAr0SyWC+mjHMvAV7eSqgaKOwljtwwpYehXHFcBqfj36/Q uQ8LXQI+sxjgd8G8fxePZ0nW2YuH0xZkdNq6hjV/G8gjeg7CGUh1+m6Lo5c9oAPJlGzY 0goR7C/f8uClsixHx1QtvsKkeXaS2aF6LP9VFRI69B0vBXgnvF62DBvJC2AaS3Sndfj2 l2eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=N9xDvIc5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4-v6si36588278pls.407.2018.05.31.07.48.31; Thu, 31 May 2018 07:48:46 -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; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=N9xDvIc5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755456AbeEaOsL (ORCPT + 99 others); Thu, 31 May 2018 10:48:11 -0400 Received: from mail-bl2nam02on0060.outbound.protection.outlook.com ([104.47.38.60]:28715 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755042AbeEaOsJ (ORCPT ); Thu, 31 May 2018 10:48:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZalAKasY+Dw2vmEYIln4QPOScdKI7J7eidyknqhKtY4=; b=N9xDvIc5dg58jUkup1B+LOhDECbNFlmDcaoLMtJ3CfeQ5hRBOFyiofNtmDXNsJZK1pW8bKvjvWaQAToudgwV1e2UItiPEYogLfAHzpK/CTycwaKtziqrg29H3BMcrnXC7O8+sqW1adcRy86Y6+AH97Ni+Zb8gcpwmwI2j6W8iSw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (50.233.148.156) by BYAPR07MB4374.namprd07.prod.outlook.com (2603:10b6:a02:c0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.797.11; Thu, 31 May 2018 14:48:06 +0000 Date: Thu, 31 May 2018 17:47:49 +0300 From: Yury Norov To: Andy Shevchenko Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] bitmap: Drop unnecessary 0 check for u32 array operations Message-ID: <20180531144749.GA6828@yury-thinkpad> References: <20180531131914.44352-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180531131914.44352-1-andriy.shevchenko@linux.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: AM0PR01CA0031.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::44) To BYAPR07MB4374.namprd07.prod.outlook.com (2603:10b6:a02:c0::17) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BYAPR07MB4374; X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4374;3:Td/anLvf1VU2OpdsbywbU1TdQuQLJ8ng7mQXyFUbPGMo0Bsow8iN1cAW6oeFFxJaTm0iXCmUQgp440QmmTaOGaGxcaiEYox7+7NmPW0AgwESO4iLQRcMsuBxhZzwLGnGlN8ym0mjs8RIIP4G6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VM16Gd5J58Cvsfp5DoN8mz+JLrI21EePScqeFB1hqFvhAXPYhmu8fUJ1llOUbJJNU/pROsEQ5MhssRyvFs0DyVDtyELxI5ZCqbn+YxzeI7e3x2mGtczndwatThVzUfuYUsOjI2OQT1BnM4HB3J/l1p+6wMsvwJSDHcV+hRnfWS/brzUtX66arN/j7REd5SliGyNFD7/5rEdRJKFNx53KdCj5C8Ii3sIqcdqEa6C3SsJ5EEBVdTIUSGDbSfOG2yRgyM5C0f75kgxYhS/6ZXlmvr/UF1FavwlSB8a5msNa09o28boE=;4:xgkXtQ2AG3LokqqROe2mfrwD3tp9X6jKbfiRRFe6BHks5uhwuYGjV21H12XWFLOuO6pE3+ta07zM6Plv0Pwv94oAzXE12qTJmPJtPYsUIsAIx8vZ5/ceoyCiZ0qiO4zV4Pj+Ip2ai8nOnO4E9AEj6x4Z/59YloTIj+slI+vvUXdLb0NubrGT2YL1zfNhX2eX/6zLc/w9STPNULsxfB8m0vXa9EhZUGP4haJmz6OT/8Ynl8RhGyLAdgaMvS82HRWSQSNyfJA7Gba2bAug3FeGN/1pP5ne6CC3eXppgCW2B3exK3ki+4rCJpdz6WVZPgSR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:BYAPR07MB4374;BCL:0;PCL:0;RULEID:;SRVR:BYAPR07MB4374; X-Forefront-PRVS: 06891E23FB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(7916004)(39380400002)(39860400002)(366004)(376002)(346002)(396003)(189003)(199004)(51914003)(50466002)(25786009)(66066001)(6246003)(11346002)(8936002)(33656002)(4326008)(5660300001)(6666003)(6916009)(8676002)(305945005)(229853002)(2906002)(106356001)(105586002)(47776003)(52116002)(7736002)(68736007)(486006)(76506005)(81156014)(6486002)(81166006)(478600001)(26005)(476003)(58126008)(316002)(42882007)(9686003)(956004)(186003)(16586007)(446003)(386003)(33896004)(72206003)(16526019)(33716001)(1076002)(23726003)(97736004)(6496006)(3846002)(53936002)(6116002)(59450400001)(76176011)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4374;H:localhost;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BYAPR07MB4374;23:S6e5BfmJheTX/WtSRr3EQd0s4KqgippfbypFWNfQK?= =?us-ascii?Q?kCyWy94Htfdbnqlg95i7lTjZB27OxF0f86NUJTrgwp4ehoVKilQsCzUyo9Pw?= =?us-ascii?Q?St/dusLjZ97Klk8LIZU4rVNZ0DKRVhCtkX60Tc+C3+tAY7us8BnfxzXn6JKm?= =?us-ascii?Q?aNtHc4JfHiHVtweMgusveLBJDePs7FRL5CxJLQHGl1tYkk4Qe804xQYV0kr3?= =?us-ascii?Q?9IscuT2aCVvmzekyjEoUR2mi/htIl/KTWEOKwi/MBWKeUz0kw9KTn5ctxMv7?= =?us-ascii?Q?SL/M4fwIeogH/p6sunTU9kVf27Y11rvE6kaSpIS5NIGn1Jqj8TcgEkS+OYIT?= =?us-ascii?Q?VATKwuemsCsca/uds9SM+RI6n55Y64cIIRKl/9HDs/PTCu2IrejcosHmizZ3?= =?us-ascii?Q?yk0VTQBclcwPnS9cJD5qpmyOMXUOzsvvEsZyp8r7XBRXoLW9Tc6NFpa9+ElF?= =?us-ascii?Q?W7iFBO8wVBJocEWR78Kb93nZC1ZKXplP8I7/7UNwkkE/lercgTIEGq1RbgrN?= =?us-ascii?Q?sVGHdiRKilV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r+Lxh2?= X-Microsoft-Antispam-Message-Info: Sa7LyV7OAf2hQLSedSfay8/4dbndwu38OSvoCyXf4O86joQIf4H01xS6ZQBOdwpPpWK0R1RlYBO+mHEX/nVQu2eo2JfTRkTDpQ894lpqAB23ZPMQonBVMZHHPBDKyFHLM5uOko6RRtXxxWVn3qjEqLovevYf21yc1XLsGX35RkRwWa3yz9dZqW2TvmV8n1Qz X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4374;6:PaMR3LhZSvkqZebZcAQ60xXIn4GkJ3AP1Mrv1+8MElPBzANgsIUFokgF+PJYvS6KAOmmHztSBuPLNHExa4ZSH0vKECz3+xVO/KqiHC/Vkaa8s0BdXpoDexge3qRNFmqIMDEieCGyqkz+/nuA2MEe1j3fF1H54W3t1jcRxRMI8fGv1NGRpSCrx6ROYiu/ZfgNSFg4DBYzq7Nrexf1fbj3QJqRz5XxNpTaq40seIAwVd14Czng8mrFrS1ZqDenMM3YOcW/OQ1gxh6sC8YnoJXE+DKzwClFx6mY7A9maRcQu3Zannq+BtFnm2UON+QZXKV4ipRBSKxhKbMIdkBji/uX/ma2CTvunGtwGkZDvnMG70pyNK3RdscBAc1Iemeedtr1AyoFQ/bDq6QCfRYBMzUJymEgUIqf3e/NRoOxgdw7VbnxgHjExtCsYwTqEM2KyRuRaSXk2FqYOrsRQy7zpcH37w==;5:IV+8TnZlsPu03L3tQEu5lL2wAIO9Jz7MNT93Qv5rQCKTvEbZZmoLXHW5/oZKVAMn0TPcna5MUCUus7BBAsy0zRd9abGT/gHP5Y2AT9MvgCiYfnV20SzyqMLQB/3jNfNze8SwmOlAzrQIK+B1LlE7C/XDV/2a/ybrJGa8qqUQsV8=;24:Tn1XC6JGB+IeVRmRoEQmtU1q7TnEMDSquq6531QGaGdJ92s0WZXacceZSv7hm8zR9sNF+ZjL/tDXzbBQO7sesfJ7fhMme/R3OansE7zMcfA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4374;7:cNDIu/AKKsR39AJ/LmegBjIF7Z+VyZmMjKg9SKUUaN6w7AAd3Q0Yyr5SZsfU3qc9Rooy/GfDIheO8XejpPlIm48+FK1FOi9l5WiOf46JrYtO/i6TUjiWJsy+a/jkC3Xo8TGoWc49l/JiGDU0/V8bVINtohhGEdIPdbuzMgM/M2blg2lJehVZt1sqnHmPASUYVoGMdg/udNT7J6A73glXmHo4uFKOfMt1a1iT7PcR4+H8ETyiostyIJ7VZDDXxOCB X-MS-Office365-Filtering-Correlation-Id: 803261f1-a415-4892-bb01-08d5c7058587 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2018 14:48:06.2447 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 803261f1-a415-4892-bb01-08d5c7058587 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4374 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 04:19:14PM +0300, Andy Shevchenko wrote: > 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 Indeed. Thanks for the catch. > --- > 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) This line is 81 characters length, and it will trigger checkpatch warning. (But I'm OK with it.) > { > 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 Acked-by: Yury Norov