[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5F87ABD6.4090508@huawei.com>
Date: Thu, 15 Oct 2020 09:54:30 +0800
From: Jing Xiangfeng <jingxiangfeng@...wei.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: <andreas.noever@...il.com>, <michael.jamet@...el.com>,
<mika.westerberg@...ux.intel.com>, <YehezkelShB@...il.com>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] thunderbolt: Add the missed ida_simple_remove() in
ring_request_msix()
On 2020/10/14 16:48, Andy Shevchenko wrote:
> On Wed, Oct 14, 2020 at 09:46:04AM +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.
> ...
>
>> @@ -406,11 +406,22 @@ 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;
>> + if (ring->irq < 0) {
>> + ret = ring->irq;
>> + goto err_ida_remove;
>> + }
> What about
> ret = pci_irq_vector(ring->nhi->pdev, ring->vector);
> if (ret < 0)
> goto err_ida_remove;
>
> ring->irq = ret;
>
> ?
Yeah, I agree. Thanks for your suggestions.
>
> (See also context above)
>
>> 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
>>
Powered by blists - more mailing lists