usb: remove dead assignments, spotted by clang analyzer
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
7300c07991
commit
d4c4e6fdc7
|
@ -152,11 +152,10 @@ static void do_attach(USBDevice *dev)
|
||||||
int usb_device_attach(USBDevice *dev)
|
int usb_device_attach(USBDevice *dev)
|
||||||
{
|
{
|
||||||
USBBus *bus = usb_bus_from_device(dev);
|
USBBus *bus = usb_bus_from_device(dev);
|
||||||
USBDevice *hub;
|
|
||||||
|
|
||||||
if (bus->nfree == 1) {
|
if (bus->nfree == 1) {
|
||||||
/* Create a new hub and chain it on. */
|
/* Create a new hub and chain it on. */
|
||||||
hub = usb_create_simple(bus, "usb-hub");
|
usb_create_simple(bus, "usb-hub");
|
||||||
}
|
}
|
||||||
do_attach(dev);
|
do_attach(dev);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -366,11 +366,10 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
|
||||||
{
|
{
|
||||||
unsigned int n = index - 1;
|
unsigned int n = index - 1;
|
||||||
USBHubPort *port;
|
USBHubPort *port;
|
||||||
USBDevice *dev;
|
|
||||||
if (n >= s->nb_ports)
|
if (n >= s->nb_ports)
|
||||||
goto fail;
|
goto fail;
|
||||||
port = &s->ports[n];
|
port = &s->ports[n];
|
||||||
dev = port->port.dev;
|
|
||||||
switch(value) {
|
switch(value) {
|
||||||
case PORT_ENABLE:
|
case PORT_ENABLE:
|
||||||
port->wPortStatus &= ~PORT_STAT_ENABLE;
|
port->wPortStatus &= ~PORT_STAT_ENABLE;
|
||||||
|
|
|
@ -972,11 +972,10 @@ static int rndis_keepalive_response(USBNetState *s,
|
||||||
|
|
||||||
static int rndis_parse(USBNetState *s, uint8_t *data, int length)
|
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;
|
le32 *tmp = (le32 *) data;
|
||||||
|
|
||||||
msg_type = le32_to_cpup(tmp++);
|
msg_type = le32_to_cpup(tmp);
|
||||||
msg_length = le32_to_cpup(tmp++);
|
|
||||||
|
|
||||||
switch (msg_type) {
|
switch (msg_type) {
|
||||||
case RNDIS_INITIALIZE_MSG:
|
case RNDIS_INITIALIZE_MSG:
|
||||||
|
|
|
@ -599,7 +599,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
|
||||||
{
|
{
|
||||||
int dir;
|
int dir;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
#ifdef DEBUG_ISOCH
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
|
#endif
|
||||||
int pid;
|
int pid;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
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);
|
dir = OHCI_BM(ed->flags, ED_D);
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case OHCI_TD_DIR_IN:
|
case OHCI_TD_DIR_IN:
|
||||||
|
#ifdef DEBUG_ISOCH
|
||||||
str = "in";
|
str = "in";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_IN;
|
pid = USB_TOKEN_IN;
|
||||||
break;
|
break;
|
||||||
case OHCI_TD_DIR_OUT:
|
case OHCI_TD_DIR_OUT:
|
||||||
|
#ifdef DEBUG_ISOCH
|
||||||
str = "out";
|
str = "out";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_OUT;
|
pid = USB_TOKEN_OUT;
|
||||||
break;
|
break;
|
||||||
case OHCI_TD_DIR_SETUP:
|
case OHCI_TD_DIR_SETUP:
|
||||||
|
#ifdef DEBUG_ISOCH
|
||||||
str = "setup";
|
str = "setup";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_SETUP;
|
pid = USB_TOKEN_SETUP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -834,7 +842,9 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
|
||||||
{
|
{
|
||||||
int dir;
|
int dir;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
#ifdef DEBUG_PACKET
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
|
#endif
|
||||||
int pid;
|
int pid;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
@ -871,15 +881,21 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
|
||||||
|
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case OHCI_TD_DIR_IN:
|
case OHCI_TD_DIR_IN:
|
||||||
|
#ifdef DEBUG_PACKET
|
||||||
str = "in";
|
str = "in";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_IN;
|
pid = USB_TOKEN_IN;
|
||||||
break;
|
break;
|
||||||
case OHCI_TD_DIR_OUT:
|
case OHCI_TD_DIR_OUT:
|
||||||
|
#ifdef DEBUG_PACKET
|
||||||
str = "out";
|
str = "out";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_OUT;
|
pid = USB_TOKEN_OUT;
|
||||||
break;
|
break;
|
||||||
case OHCI_TD_DIR_SETUP:
|
case OHCI_TD_DIR_SETUP:
|
||||||
|
#ifdef DEBUG_PACKET
|
||||||
str = "setup";
|
str = "setup";
|
||||||
|
#endif
|
||||||
pid = USB_TOKEN_SETUP;
|
pid = USB_TOKEN_SETUP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -449,7 +449,7 @@ static int usb_serial_handle_data(USBDevice *dev, USBPacket *p)
|
||||||
/* handle serial break */
|
/* handle serial break */
|
||||||
if (s->event_trigger && s->event_trigger & FTDI_BI) {
|
if (s->event_trigger && s->event_trigger & FTDI_BI) {
|
||||||
s->event_trigger &= ~FTDI_BI;
|
s->event_trigger &= ~FTDI_BI;
|
||||||
*data++ = FTDI_BI;
|
*data = FTDI_BI;
|
||||||
ret = 2;
|
ret = 2;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -698,7 +698,6 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_
|
||||||
|
|
||||||
if (pid == USB_TOKEN_IN) {
|
if (pid == USB_TOKEN_IN) {
|
||||||
if (len > max_len) {
|
if (len > max_len) {
|
||||||
len = max_len;
|
|
||||||
ret = USB_RET_BABBLE;
|
ret = USB_RET_BABBLE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -865,7 +864,6 @@ static void uhci_async_complete(USBPacket *packet, void *opaque)
|
||||||
UHCI_TD td;
|
UHCI_TD td;
|
||||||
uint32_t link = async->td;
|
uint32_t link = async->td;
|
||||||
uint32_t int_mask = 0, val;
|
uint32_t int_mask = 0, val;
|
||||||
int len;
|
|
||||||
|
|
||||||
cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td));
|
cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td));
|
||||||
le32_to_cpus(&td.link);
|
le32_to_cpus(&td.link);
|
||||||
|
@ -874,7 +872,7 @@ static void uhci_async_complete(USBPacket *packet, void *opaque)
|
||||||
le32_to_cpus(&td.buffer);
|
le32_to_cpus(&td.buffer);
|
||||||
|
|
||||||
uhci_async_unlink(s, async);
|
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;
|
s->pending_int_mask |= int_mask;
|
||||||
|
|
||||||
/* update the status bits of the TD */
|
/* update the status bits of the TD */
|
||||||
|
|
|
@ -287,7 +287,7 @@ static void async_cancel(USBPacket *unused, void *opaque)
|
||||||
static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
|
static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
|
||||||
{
|
{
|
||||||
int dev_descr_len, config_descr_len;
|
int dev_descr_len, config_descr_len;
|
||||||
int interface, nb_interfaces, nb_configurations;
|
int interface, nb_interfaces;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
if (configuration == 0) /* address state - ignore */
|
if (configuration == 0) /* address state - ignore */
|
||||||
|
@ -299,7 +299,6 @@ static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
|
||||||
dev_descr_len = dev->descr[0];
|
dev_descr_len = dev->descr[0];
|
||||||
if (dev_descr_len > dev->descr_len)
|
if (dev_descr_len > dev->descr_len)
|
||||||
goto fail;
|
goto fail;
|
||||||
nb_configurations = dev->descr[17];
|
|
||||||
|
|
||||||
i += dev_descr_len;
|
i += dev_descr_len;
|
||||||
while (i < dev->descr_len) {
|
while (i < dev->descr_len) {
|
||||||
|
|
Loading…
Reference in a new issue