From patchwork Tue Jan 11 01:26:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Li X-Patchwork-Id: 12709391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF9CC433EF for ; Tue, 11 Jan 2022 01:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243664AbiAKB0b (ORCPT ); Mon, 10 Jan 2022 20:26:31 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:54865 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243671AbiAKB01 (ORCPT ); Mon, 10 Jan 2022 20:26:27 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0V1X3B4-_1641864384; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0V1X3B4-_1641864384) by smtp.aliyun-inc.com(127.0.0.1); Tue, 11 Jan 2022 09:26:25 +0800 From: Yang Li To: kys@microsoft.com Cc: haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li , Abaci Robot Subject: [PATCH -next] PCI: hv: Unsigned comparison with less than zero Date: Tue, 11 Jan 2022 09:26:22 +0800 Message-Id: <20220111012622.19447-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The return from the call to bitmap_find_free_region() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'index', so making 'index' an int. Eliminate the following coccicheck warning: ./drivers/pci/controller/pci-hyperv.c:712:5-10: WARNING: Unsigned expression compared with zero: index < 0 Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/pci/controller/pci-hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 26c9c8ec0989..20ea2ee330b8 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -701,7 +701,7 @@ static int hv_pci_vec_alloc_device_irq(struct irq_domain *domain, irq_hw_number_t *hwirq) { struct hv_pci_chip_data *chip_data = domain->host_data; - unsigned int index; + int index; /* Find and allocate region from the SPI bitmap */ mutex_lock(&chip_data->map_lock);