summaryrefslogtreecommitdiffstats
path: root/hw/usb-net.c
diff options
context:
space:
mode:
authorPeter Maydell2011-11-09 22:09:23 +0100
committerAnthony Liguori2011-12-12 18:16:53 +0100
commit98d23704138e0be17a3ed9eb2631077bf92cc028 (patch)
tree332c39a4d63f05c04835b5090ada314464fefa6a /hw/usb-net.c
parentRemove unnecessary casts from PCI DMA code in usb-uhci (diff)
downloadqemu-98d23704138e0be17a3ed9eb2631077bf92cc028.tar.gz
qemu-98d23704138e0be17a3ed9eb2631077bf92cc028.tar.xz
qemu-98d23704138e0be17a3ed9eb2631077bf92cc028.zip
hw/usb-net.c: Fix precedence bug when checking rndis_state
"!X == 2" is always false (spotted by Coverity), so the checks for whether rndis is in the correct state would never fire. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-net.c')
-rw-r--r--hw/usb-net.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/usb-net.c b/hw/usb-net.c
index a8b7c8dd76..f91fa32334 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1268,8 +1268,9 @@ static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t si
if (is_rndis(s)) {
msg = (struct rndis_packet_msg_type *) s->in_buf;
- if (!s->rndis_state == RNDIS_DATA_INITIALIZED)
+ if (s->rndis_state != RNDIS_DATA_INITIALIZED) {
return -1;
+ }
if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf))
return -1;
@@ -1302,7 +1303,7 @@ static int usbnet_can_receive(VLANClientState *nc)
{
USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
- if (is_rndis(s) && !s->rndis_state == RNDIS_DATA_INITIALIZED) {
+ if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) {
return 1;
}