Skip to content

Commit

Permalink
ice: Fix signedness bug in ice_init_interrupt_scheme()
Browse files Browse the repository at this point in the history
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: 79d97b8 ("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>
  • Loading branch information
Dan Carpenter authored and Jakub Kicinski committed Feb 15, 2025
1 parent de38503 commit c2ddb61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)

vectors = pci_alloc_irq_vectors(pf->pdev, pf->msix.min, vectors,
PCI_IRQ_MSIX);
if (vectors < pf->msix.min)
return -ENOMEM;
if (vectors < 0)
return vectors;

ice_init_irq_tracker(pf, pf->msix.max, vectors);

Expand Down

0 comments on commit c2ddb61

Please sign in to comment.