aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/xen-usb.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-03-23 16:43:18 +0000
committerAnthony PERARD <anthony.perard@citrix.com>2020-04-07 16:13:26 +0100
commit1aef27c93d351cf6235dbc06d112f626a9aaeba6 (patch)
treebf903f69132df5382691b39f0854ea402cfae9e5 /hw/usb/xen-usb.c
parent8f0d25c464a1989d606f7b988d07b1147dfcde33 (diff)
hw/usb/xen-usb.c: Pass struct usbback_req* to usbback_packet_complete()
The function usbback_packet_complete() currently takes a USBPacket*, which must be a pointer to the packet field within a struct usbback_req; the function uses container_of() to get the struct usbback_req* given the USBPacket*. This is unnecessarily confusing (and in particular it confuses the Coverity Scan analysis, resulting in the false positive CID 1421919 where it thinks that we write off the end of the structure). Since both callsites already have the pointer to the struct usbback_req, just pass that in directly. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20200323164318.26567-1-peter.maydell@linaro.org> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Diffstat (limited to 'hw/usb/xen-usb.c')
-rw-r--r--hw/usb/xen-usb.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 1fc2f32ce9..961190d0f7 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -347,13 +347,11 @@ static int32_t usbback_xlat_status(int status)
return -ESHUTDOWN;
}
-static void usbback_packet_complete(USBPacket *packet)
+static void usbback_packet_complete(struct usbback_req *usbback_req)
{
- struct usbback_req *usbback_req;
+ USBPacket *packet = &usbback_req->packet;
int32_t status;
- usbback_req = container_of(packet, struct usbback_req, packet);
-
QTAILQ_REMOVE(&usbback_req->stub->submit_q, usbback_req, q);
status = usbback_xlat_status(packet->status);
@@ -566,7 +564,7 @@ static void usbback_dispatch(struct usbback_req *usbback_req)
usb_handle_packet(usbback_req->stub->dev, &usbback_req->packet);
if (usbback_req->packet.status != USB_RET_ASYNC) {
- usbback_packet_complete(&usbback_req->packet);
+ usbback_packet_complete(usbback_req);
}
return;
@@ -993,7 +991,7 @@ static void xen_bus_complete(USBPort *port, USBPacket *packet)
usbif = usbback_req->usbif;
TR_REQ(&usbif->xendev, "\n");
- usbback_packet_complete(packet);
+ usbback_packet_complete(usbback_req);
}
static USBPortOps xen_usb_port_ops = {