* [PATCH -next v2] habanalabs/gaudi2: fix free irq in error path in gaudi2_enable_msix()
@ 2022-09-13 3:07 Yang Yingliang
2022-09-18 10:28 ` Oded Gabbay
0 siblings, 1 reply; 3+ messages in thread
From: Yang Yingliang @ 2022-09-13 3:07 UTC (permalink / raw)
To: linux-kernel; +Cc: ogabbay
Add two variables to store completion irq and event queue irq. And add
a new lable to free event queue irq in error path in gaudi2_enable_msix().
Fixes: d7bb1ac89b2f ("habanalabs: add gaudi2 asic-specific code")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v2:
print correct irq in error prints.
---
drivers/misc/habanalabs/gaudi2/gaudi2.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
index 98336a1a84b0..8f521d8a1aa1 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
@@ -3518,6 +3518,7 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
struct asic_fixed_properties *prop = &hdev->asic_prop;
struct gaudi2_device *gaudi2 = hdev->asic_specific;
int rc, irq, i, j, user_irq_init_cnt;
+ int completion_irq, event_queue_irq;
irq_handler_t irq_handler;
struct hl_cq *cq;
@@ -3532,26 +3533,28 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
return rc;
}
- irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
+ completion_irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
cq = &hdev->completion_queue[GAUDI2_RESERVED_CQ_CS_COMPLETION];
- rc = request_irq(irq, hl_irq_handler_cq, 0, gaudi2_irq_name(GAUDI2_IRQ_NUM_COMPLETION), cq);
+ rc = request_irq(completion_irq, hl_irq_handler_cq, 0,
+ gaudi2_irq_name(GAUDI2_IRQ_NUM_COMPLETION), cq);
if (rc) {
- dev_err(hdev->dev, "Failed to request IRQ %d", irq);
+ dev_err(hdev->dev, "Failed to request IRQ %d", completion_irq);
goto free_irq_vectors;
}
- irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_EVENT_QUEUE);
- rc = request_irq(irq, hl_irq_handler_eq, 0, gaudi2_irq_name(GAUDI2_IRQ_NUM_EVENT_QUEUE),
- &hdev->event_queue);
+ event_queue_irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_EVENT_QUEUE);
+ rc = request_irq(event_queue_irq, hl_irq_handler_eq, 0,
+ gaudi2_irq_name(GAUDI2_IRQ_NUM_EVENT_QUEUE),
+ &hdev->event_queue);
if (rc) {
- dev_err(hdev->dev, "Failed to request IRQ %d", irq);
+ dev_err(hdev->dev, "Failed to request IRQ %d", event_queue_irq);
goto free_completion_irq;
}
rc = gaudi2_dec_enable_msix(hdev);
if (rc) {
dev_err(hdev->dev, "Failed to enable decoder IRQ");
- goto free_completion_irq;
+ goto free_event_queue_irq;
}
for (i = GAUDI2_IRQ_NUM_USER_FIRST, j = prop->user_dec_intr_count, user_irq_init_cnt = 0;
@@ -3582,9 +3585,11 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
gaudi2_dec_disable_msix(hdev, GAUDI2_IRQ_NUM_SHARED_DEC1_ABNRM + 1);
+free_event_queue_irq:
+ free_irq(event_queue_irq, &hdev->event_queue);
+
free_completion_irq:
- irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
- free_irq(irq, cq);
+ free_irq(completion_irq, cq);
free_irq_vectors:
pci_free_irq_vectors(hdev->pdev);
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next v2] habanalabs/gaudi2: fix free irq in error path in gaudi2_enable_msix()
2022-09-13 3:07 [PATCH -next v2] habanalabs/gaudi2: fix free irq in error path in gaudi2_enable_msix() Yang Yingliang
@ 2022-09-18 10:28 ` Oded Gabbay
2022-09-19 1:17 ` Yang Yingliang
0 siblings, 1 reply; 3+ messages in thread
From: Oded Gabbay @ 2022-09-18 10:28 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel
On Tue, Sep 13, 2022 at 6:00 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> Add two variables to store completion irq and event queue irq. And add
> a new lable to free event queue irq in error path in gaudi2_enable_msix().
I'm sorry, I already pushed a fix to the bug (I didn't get any reply
from you for more than a week so I didn't know if you are going to fix
it).
Oded
>
> Fixes: d7bb1ac89b2f ("habanalabs: add gaudi2 asic-specific code")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> v2:
> print correct irq in error prints.
> ---
> drivers/misc/habanalabs/gaudi2/gaudi2.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
> index 98336a1a84b0..8f521d8a1aa1 100644
> --- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
> +++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
> @@ -3518,6 +3518,7 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
> struct asic_fixed_properties *prop = &hdev->asic_prop;
> struct gaudi2_device *gaudi2 = hdev->asic_specific;
> int rc, irq, i, j, user_irq_init_cnt;
> + int completion_irq, event_queue_irq;
> irq_handler_t irq_handler;
> struct hl_cq *cq;
>
> @@ -3532,26 +3533,28 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
> return rc;
> }
>
> - irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
> + completion_irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
> cq = &hdev->completion_queue[GAUDI2_RESERVED_CQ_CS_COMPLETION];
> - rc = request_irq(irq, hl_irq_handler_cq, 0, gaudi2_irq_name(GAUDI2_IRQ_NUM_COMPLETION), cq);
> + rc = request_irq(completion_irq, hl_irq_handler_cq, 0,
> + gaudi2_irq_name(GAUDI2_IRQ_NUM_COMPLETION), cq);
> if (rc) {
> - dev_err(hdev->dev, "Failed to request IRQ %d", irq);
> + dev_err(hdev->dev, "Failed to request IRQ %d", completion_irq);
> goto free_irq_vectors;
> }
>
> - irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_EVENT_QUEUE);
> - rc = request_irq(irq, hl_irq_handler_eq, 0, gaudi2_irq_name(GAUDI2_IRQ_NUM_EVENT_QUEUE),
> - &hdev->event_queue);
> + event_queue_irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_EVENT_QUEUE);
> + rc = request_irq(event_queue_irq, hl_irq_handler_eq, 0,
> + gaudi2_irq_name(GAUDI2_IRQ_NUM_EVENT_QUEUE),
> + &hdev->event_queue);
> if (rc) {
> - dev_err(hdev->dev, "Failed to request IRQ %d", irq);
> + dev_err(hdev->dev, "Failed to request IRQ %d", event_queue_irq);
> goto free_completion_irq;
> }
>
> rc = gaudi2_dec_enable_msix(hdev);
> if (rc) {
> dev_err(hdev->dev, "Failed to enable decoder IRQ");
> - goto free_completion_irq;
> + goto free_event_queue_irq;
> }
>
> for (i = GAUDI2_IRQ_NUM_USER_FIRST, j = prop->user_dec_intr_count, user_irq_init_cnt = 0;
> @@ -3582,9 +3585,11 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
>
> gaudi2_dec_disable_msix(hdev, GAUDI2_IRQ_NUM_SHARED_DEC1_ABNRM + 1);
>
> +free_event_queue_irq:
> + free_irq(event_queue_irq, &hdev->event_queue);
> +
> free_completion_irq:
> - irq = pci_irq_vector(hdev->pdev, GAUDI2_IRQ_NUM_COMPLETION);
> - free_irq(irq, cq);
> + free_irq(completion_irq, cq);
>
> free_irq_vectors:
> pci_free_irq_vectors(hdev->pdev);
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next v2] habanalabs/gaudi2: fix free irq in error path in gaudi2_enable_msix()
2022-09-18 10:28 ` Oded Gabbay
@ 2022-09-19 1:17 ` Yang Yingliang
0 siblings, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-09-19 1:17 UTC (permalink / raw)
To: Oded Gabbay; +Cc: linux-kernel
On 2022/9/18 18:28, Oded Gabbay wrote:
> On Tue, Sep 13, 2022 at 6:00 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>> Add two variables to store completion irq and event queue irq. And add
>> a new lable to free event queue irq in error path in gaudi2_enable_msix().
> I'm sorry, I already pushed a fix to the bug (I didn't get any reply
> from you for more than a week so I didn't know if you are going to fix
> it).
> Oded
It's OK.
Thanks,
Yang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-19 1:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 3:07 [PATCH -next v2] habanalabs/gaudi2: fix free irq in error path in gaudi2_enable_msix() Yang Yingliang
2022-09-18 10:28 ` Oded Gabbay
2022-09-19 1:17 ` Yang Yingliang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®