Skip to contentSkip to conversation

rtase: Fix a check for error in rtase_alloc_msix()

PATCH Applied Dan Carpenter 4 participants 4 messages Jan 8, 2025 – Jan 9, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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.

Fixes a36e9f5cfe9e ("rtase: Add support for a pci table in this module")

---
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
index 585d0b21c9e0..3bd11cb56294 100644
@@ -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
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
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")

LGTM,

Signature · 2 lines
Regards,
Kalesh AP
#3 lore raw
In reply to Dan Carpenter
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")

[...]

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