From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Julia Lawall <julia.lawall@lip6.fr>, Geliang Tang <geliangtang@163.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] usb: xhci: use list_for_each_entry
Date: Mon, 21 Dec 2015 15:09:11 +0200 [thread overview]
Message-ID: <5677F9F7.8060201@linux.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1512181926580.2499@hadrien>
On 18.12.2015 20:30, Julia Lawall wrote:
> Geliang,
>
> Please check whether it is acceptable that last_unlinked_td point to the
> dummy entry at th beginning of the list, in the case where the
> list_for_each_entry loop runs out normally.
>
> It seems that you have sent a bunch of these patches. Please recheck them
> all to see if they really follow the semantics of list_for_each_entry
> properly. If particular, you should not normally use the index variable
> after leaving the loop, unless it is guaranteed that the exit from the
> loop was via a break.
>
Julia is correct, we can't use list_for_each_entry() here as cur_td would end up
pointing to list head, and we really need it to point to the last entry in the list at that point.
old:
- list_for_each(entry, &ep->cancelled_td_list) {
- cur_td = list_entry(entry, struct xhci_td, cancelled_td_list);
cur_td_will point to last element in list. "entry" will point to head, but is on longer used.
new:
+ list_for_each_entry(cur_td, &ep->cancelled_td_list, cancelled_td_list) {
cur_td will point to head of list.
This is important as newly canceled TDs can be added to the tail of the list while
looping through and returning the canceled TDs. We want to make sure we
only return and delete the TDs up to the point we have handled them on the ring.
(code continues with: last_unlinked_td = cur_td;)
Thanks Julia for spotting this
-Mathias
next prev parent reply other threads:[~2015-12-21 13:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201512190233.xPC4M6l4%fengguang.wu@intel.com>
2015-12-18 18:30 ` [PATCH 5/9] usb: xhci: use list_for_each_entry Julia Lawall
2015-12-21 13:09 ` Mathias Nyman [this message]
2015-12-18 16:34 [PATCH 1/9] usb: host: fotg210: use list_for_each_entry_safe Geliang Tang
2015-12-18 16:34 ` [PATCH 5/9] usb: xhci: use list_for_each_entry Geliang Tang
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=5677F9F7.8060201@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=geliangtang@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox