From: Jing Xiangfeng <jingxiangfeng@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <andreas.noever@gmail.com>, <michael.jamet@intel.com>,
<mika.westerberg@linux.intel.com>, <YehezkelShB@gmail.com>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix()
Date: Thu, 15 Oct 2020 09:54:30 +0800 [thread overview]
Message-ID: <5F87ABD6.4090508@huawei.com> (raw)
In-Reply-To: <20201014084821.GR4077@smile.fi.intel.com>
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
>>
prev parent reply other threads:[~2020-10-15 1:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 1:46 [PATCH v2] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() Jing Xiangfeng
2020-10-14 8:48 ` Andy Shevchenko
2020-10-15 1:54 ` Jing Xiangfeng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5F87ABD6.4090508@huawei.com \
--to=jingxiangfeng@huawei.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.