From: Michael Tokarev <mjt@tls.msk.ru>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Hans de Goede <hdegoede@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] xhci: remove unused code
Date: Wed, 29 Apr 2015 09:48:51 +0300 [thread overview]
Message-ID: <55407ED3.102@msgid.tls.msk.ru> (raw)
In-Reply-To: <1430212264-9672-3-git-send-email-arei.gonglei@huawei.com>
28.04.2015 12:11, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Value from xfer->packet.ep is assigned to ep here, but that
> stored value is not used before it is overwritten. Remove it.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> hw/usb/hcd-xhci.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index ba15ae0..99f11fc 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -2204,7 +2204,6 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
> if (epid == 1) {
> if (xhci_fire_ctl_transfer(xhci, xfer) >= 0) {
> epctx->next_xfer = (epctx->next_xfer + 1) % TD_QUEUE;
> - ep = xfer->packet.ep;
> } else {
> DPRINTF("xhci: error firing CTL transfer\n");
> }
This one is somewhat fun. ep variable is not used in whole this
function until the very end, with the code:
ep = xhci_epid_to_usbep(xhci, slotid, epid);
if (ep) {
usb_device_flush_ep_queue(ep->dev, ep);
}
There are only 2 assignments to it here, it is the NULL
initializer and this place which is being removed by this
patch (which is obviously unused).
So, I think if we were to drop this assignment, we should
remove the initializer too. But before doing this, I think
we should try to remember _why_ this assignment is here in
the first place. The code looks like after the loop, this
ep variable was supposed to be used for something. Or is
it just a leftover from 518ad5f2a075 (Cc'ing the author)?
I haven't looked at all this in more details without good
knowlege of the protocol and background.
Thanks,
/mjt
next prev parent reply other threads:[~2015-04-29 6:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 9:11 [Qemu-devel] [PATCH 0/3] trivial patches arei.gonglei
2015-04-28 9:11 ` [Qemu-devel] [PATCH 1/3] target-mips: fix memory leak arei.gonglei
2015-04-28 11:46 ` Leon Alrae
2015-04-28 9:11 ` [Qemu-devel] [PATCH 2/3] xhci: remove unused code arei.gonglei
2015-04-29 6:48 ` Michael Tokarev [this message]
2015-04-29 7:22 ` Gonglei
2015-05-05 9:55 ` Gerd Hoffmann
2015-05-05 10:18 ` Michael Tokarev
2015-04-28 9:11 ` [Qemu-devel] [PATCH 3/3] vhost-user: remove superfluous '\n' around error_report() arei.gonglei
2015-04-28 12:08 ` Andreas Färber
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=55407ED3.102@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=arei.gonglei@huawei.com \
--cc=hdegoede@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).