lkml.org 
[lkml]   [2022]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next] PCI: hv: Unsigned comparison with less than zero
Date
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 <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
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);
--
2.20.1.7.g153144c
\
 
 \ /
  Last update: 2022-01-11 02:27    [W:0.039 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site