Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ice: Fix signedness bug in ice_init_interrupt_scheme()

If pci_alloc_irq_vectors() can't allocate the minimum number of vectors
then it returns -ENOSPC so there is no need to check for that in the
caller. In fact, because pf->msix.min is an unsigned int, it means that
any negative error codes are type promoted to high positive values and
treated as success. So here, the "return -ENOMEM;" is unreachable code.
Check for negatives instead.

Now that we're only dealing with error codes, it's easier to propagate
the error code from pci_alloc_irq_vectors() instead of hardcoding
-ENOMEM.

Fixes: 79d97b8cf9a8 ("ice: remove splitting MSI-X between features")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/b16e4f01-4c85-46e2-b602-fce529293559@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dan Carpenter and committed by
Jakub Kicinski
c2ddb619 de38503b

+2 -2
+2 -2
drivers/net/ethernet/intel/ice/ice_irq.c
··· 149 149 150 150 vectors = pci_alloc_irq_vectors(pf->pdev, pf->msix.min, vectors, 151 151 PCI_IRQ_MSIX); 152 - if (vectors < pf->msix.min) 153 - return -ENOMEM; 152 + if (vectors < 0) 153 + return vectors; 154 154 155 155 ice_init_irq_tracker(pf, pf->msix.max, vectors); 156 156