* [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
@ 2020-10-15 8:40 Jing Xiangfeng
2020-10-15 10:55 ` Andy Shevchenko
2020-10-26 15:31 ` Mika Westerberg
0 siblings, 2 replies; 3+ messages in thread
From: Jing Xiangfeng @ 2020-10-15 8:40 UTC (permalink / raw)
To: andreas.noever, michael.jamet, mika.westerberg, YehezkelShB,
andriy.shevchenko, gregkh
Cc: linux-usb, linux-kernel, jingxiangfeng
ring_request_msix() misses to call ida_simple_remove() in an error path.
Add a label 'err_ida_remove' and jump to it.
Fixes: 046bee1f9ab8 ("thunderbolt: Add MSI-X support")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
drivers/thunderbolt/nhi.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 5f7489fa1327..a331e52789e3 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -405,12 +405,23 @@ 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)
- return ring->irq;
+ ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
+ if (ret < 0)
+ goto err_ida_remove;
+
+ ring->irq = ret;
irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
- return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
+ ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
+ if (ret)
+ goto err_ida_remove;
+
+ return 0;
+
+err_ida_remove:
+ ida_simple_remove(&nhi->msix_ida, ring->vector);
+
+ return ret;
}
static void ring_release_msix(struct tb_ring *ring)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
2020-10-15 8:40 [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() Jing Xiangfeng
@ 2020-10-15 10:55 ` Andy Shevchenko
2020-10-26 15:31 ` Mika Westerberg
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-10-15 10:55 UTC (permalink / raw)
To: Jing Xiangfeng
Cc: andreas.noever, michael.jamet, mika.westerberg, YehezkelShB,
gregkh, linux-usb, linux-kernel
On Thu, Oct 15, 2020 at 04:40:53PM +0800, Jing Xiangfeng wrote:
> ring_request_msix() misses to call ida_simple_remove() in an error path.
> Add a label 'err_ida_remove' and jump to it.
FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes: 046bee1f9ab8 ("thunderbolt: Add MSI-X support")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> ---
When new version is issued do not forget to add changelog here (after cutter '---' line).
> drivers/thunderbolt/nhi.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> index 5f7489fa1327..a331e52789e3 100644
> --- a/drivers/thunderbolt/nhi.c
> +++ b/drivers/thunderbolt/nhi.c
> @@ -405,12 +405,23 @@ 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)
> - return ring->irq;
> + ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
> + if (ret < 0)
> + goto err_ida_remove;
> +
> + ring->irq = ret;
>
> irqflags = no_suspend ? IRQF_NO_SUSPEND : 0;
> - return request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
> + ret = request_irq(ring->irq, ring_msix, irqflags, "thunderbolt", ring);
> + if (ret)
> + goto err_ida_remove;
> +
> + return 0;
> +
> +err_ida_remove:
> + ida_simple_remove(&nhi->msix_ida, ring->vector);
> +
> + return ret;
> }
>
> static void ring_release_msix(struct tb_ring *ring)
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
2020-10-15 8:40 [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() Jing Xiangfeng
2020-10-15 10:55 ` Andy Shevchenko
@ 2020-10-26 15:31 ` Mika Westerberg
1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2020-10-26 15:31 UTC (permalink / raw)
To: Jing Xiangfeng
Cc: andreas.noever, michael.jamet, YehezkelShB, andriy.shevchenko,
gregkh, linux-usb, linux-kernel
On Thu, Oct 15, 2020 at 04:40:53PM +0800, Jing Xiangfeng wrote:
> ring_request_msix() misses to call ida_simple_remove() in an error path.
> Add a label 'err_ida_remove' and jump to it.
>
> Fixes: 046bee1f9ab8 ("thunderbolt: Add MSI-X support")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Applied to thunderbolt.git/fixes, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-26 15:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 8:40 [PATCH v3] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() Jing Xiangfeng
2020-10-15 10:55 ` Andy Shevchenko
2020-10-26 15:31 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).