[PATCH] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()

From: Jing Xiangfeng
Date: Mon Oct 12 2020 - 22:42:18 EST


ring_request_msix() misses to call ida_simple_remove() in an error path.
Add the missed function call to fix it.

Fixes: 046bee1f9ab8 ("thunderbolt: Add MSI-X support")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@xxxxxxxxxx>
---
drivers/thunderbolt/nhi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 5f7489fa1327..7732e7a9942f 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -406,8 +406,10 @@ static int ring_request_msix(struct tb_ring *ring, bool no_suspend)
ring->vector = ret;

ring->irq = pci_irq_vector(ring->nhi->pdev, ring->vector);
- if (ring->irq < 0)
+ if (ring->irq < 0) {
+ ida_simple_remove(&nhi->msix_ida, ret);
return ring->irq;
+ }

irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
--
2.17.1