rtase: Fix a check for error in rtase_alloc_msix()
Subsystems (4)
PATCH 1/1 rtase: Fix a check for error in rtase_alloc_msix()
The pci_irq_vector() function never returns zero. It returns negative error codes or a positive non-zero IRQ number. Fix the error checking to test for negatives.
---
For more information about the history of IRQ returns see my blog:
https://staticthinking.wordpress.com/2023/08/07/writing-a-check-for-zero-irq-error-codes/
drivers/net/ethernet/realtek/rtase/rtase_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/rtase/rtase_main.c +1 -1
@@ -1828,7 +1828,7 @@ static int rtase_alloc_msix(struct pci_dev *pdev, struct rtase_private *tp)for (i =0 ; i < tp->int_nums; i++) { irq =pci_irq_vector (pdev, i); -if (!irq) { +if (irq <0 ) {pci_disable_msix (pdev);return irq; }
Signature · 1 line
2.45.2
Quoted 6 lines · Dan Carpenter
The
pci_irq_vector()function never returns zero. It returns negative error codes or a positive non-zero IRQ number. Fix the error checking to test for negatives.Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")Signed-off-by Dan Carpenter <[email protected]>
Quoted 7 lines · Dan Carpenter
The
pci_irq_vector()function never returns zero. It returns negative error codes or a positive non-zero IRQ number. Fix the error checking to test for negatives.Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")Signed-off-by Dan Carpenter <[email protected]>
LGTM,
Signature · 2 lines
Regards, Kalesh AP
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 8 Jan 2025 12:15:53 +0300 you wrote:
The
pci_irq_vector()function never returns zero. It returns negative error codes or a positive non-zero IRQ number. Fix the error checking to test for negatives.Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")Signed-off-by Dan Carpenter <[email protected]>[...]
Here is the summary with links:
- [net] rtase: Fix a check for error in rtase_alloc_msix()
https://git.kernel.org/netdev/net/c/2055272e3ae0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html