summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-04-25 18:23:04 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-04-25 18:23:04 +0000
commitd4c4e6fdc7f5077fba3446f6e650eb94d07a0be5 (patch)
tree30a0e68d4a839c12488f2e234a9cb8cb4e2aaa62 /hw
parent7300c07991e05e66e04528aa1c72e31c127a79cd (diff)
downloadqemu-d4c4e6fdc7f5077fba3446f6e650eb94d07a0be5.tar.gz
qemu-d4c4e6fdc7f5077fba3446f6e650eb94d07a0be5.tar.bz2
qemu-d4c4e6fdc7f5077fba3446f6e650eb94d07a0be5.zip
usb: remove dead assignments, spotted by clang analyzer
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb-bus.c3
-rw-r--r--hw/usb-hub.c3
-rw-r--r--hw/usb-net.c5
-rw-r--r--hw/usb-ohci.c16
-rw-r--r--hw/usb-serial.c2
-rw-r--r--hw/usb-uhci.c6
6 files changed, 23 insertions, 12 deletions
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index ee0e9e30e7..b692503f54 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -152,11 +152,10 @@ static void do_attach(USBDevice *dev)
int usb_device_attach(USBDevice *dev)
{
USBBus *bus = usb_bus_from_device(dev);
- USBDevice *hub;
if (bus->nfree == 1) {
/* Create a new hub and chain it on. */
- hub = usb_create_simple(bus, "usb-hub");
+ usb_create_simple(bus, "usb-hub");
}
do_attach(dev);
return 0;
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 1aee7fe5b4..2a1edfc956 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -366,11 +366,10 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
{
unsigned int n = index - 1;
USBHubPort *port;
- USBDevice *dev;
+
if (n >= s->nb_ports)
goto fail;
port = &s->ports[n];
- dev = port->port.dev;
switch(value) {
case PORT_ENABLE:
port->wPortStatus &= ~PORT_STAT_ENABLE;
diff --git a/hw/usb-net.c b/hw/usb-net.c
index ff0ca44237..a43bd17636 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -972,11 +972,10 @@ static int rndis_keepalive_response(USBNetState *s,
static int rndis_parse(USBNetState *s, uint8_t *data, int length)
{
- uint32_t msg_type, msg_length;
+ uint32_t msg_type;
le32 *tmp = (le32 *) data;
- msg_type = le32_to_cpup(tmp++);
- msg_length = le32_to_cpup(tmp++);
+ msg_type = le32_to_cpup(tmp);
switch (msg_type) {
case RNDIS_INITIALIZE_MSG:
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 7cd5ca0c51..9f80e159ad 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -599,7 +599,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
{
int dir;
size_t len = 0;
+#ifdef DEBUG_ISOCH
const char *str = NULL;
+#endif
int pid;
int ret;
int i;
@@ -663,15 +665,21 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
dir = OHCI_BM(ed->flags, ED_D);
switch (dir) {
case OHCI_TD_DIR_IN:
+#ifdef DEBUG_ISOCH
str = "in";
+#endif
pid = USB_TOKEN_IN;
break;
case OHCI_TD_DIR_OUT:
+#ifdef DEBUG_ISOCH
str = "out";
+#endif
pid = USB_TOKEN_OUT;
break;
case OHCI_TD_DIR_SETUP:
+#ifdef DEBUG_ISOCH
str = "setup";
+#endif
pid = USB_TOKEN_SETUP;
break;
default:
@@ -834,7 +842,9 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
{
int dir;
size_t len = 0;
+#ifdef DEBUG_PACKET
const char *str = NULL;
+#endif
int pid;
int ret;
int i;
@@ -871,15 +881,21 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
switch (dir) {
case OHCI_TD_DIR_IN:
+#ifdef DEBUG_PACKET
str = "in";
+#endif
pid = USB_TOKEN_IN;
break;
case OHCI_TD_DIR_OUT:
+#ifdef DEBUG_PACKET
str = "out";
+#endif
pid = USB_TOKEN_OUT;
break;
case OHCI_TD_DIR_SETUP:
+#ifdef DEBUG_PACKET
str = "setup";
+#endif
pid = USB_TOKEN_SETUP;
break;
default:
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 69f0e44f11..5b2483ab44 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -449,7 +449,7 @@ static int usb_serial_handle_data(USBDevice *dev, USBPacket *p)
/* handle serial break */
if (s->event_trigger && s->event_trigger & FTDI_BI) {
s->event_trigger &= ~FTDI_BI;
- *data++ = FTDI_BI;
+ *data = FTDI_BI;
ret = 2;
break;
} else {
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 7c45d7f512..624d55b3b2 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -698,7 +698,6 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_
if (pid == USB_TOKEN_IN) {
if (len > max_len) {
- len = max_len;
ret = USB_RET_BABBLE;
goto out;
}
@@ -865,8 +864,7 @@ static void uhci_async_complete(USBPacket *packet, void *opaque)
UHCI_TD td;
uint32_t link = async->td;
uint32_t int_mask = 0, val;
- int len;
-
+
cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td));
le32_to_cpus(&td.link);
le32_to_cpus(&td.ctrl);
@@ -874,7 +872,7 @@ static void uhci_async_complete(USBPacket *packet, void *opaque)
le32_to_cpus(&td.buffer);
uhci_async_unlink(s, async);
- len = uhci_complete_td(s, &td, async, &int_mask);
+ uhci_complete_td(s, &td, async, &int_mask);
s->pending_int_mask |= int_mask;
/* update the status bits of the TD */