ehci: Assert state machine is sane w.r.t. EHCIQueue
authorMarkus Armbruster <armbru@redhat.com>
Thu, 10 Jan 2013 13:33:23 +0000 (14:33 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 14 Jan 2013 11:47:11 +0000 (12:47 +0100)
Coverity worries the EHCIQueue pointer could be null when we pass it
to functions that reference it.  The state machine ensures it can't be
null then.  Assert that, to hush the checker.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ehci.c

index 320b7e72393ef5d5b9446bd91f5ee76b6abce280..70406592ef47fa3c396adc1fda05c7a592aa83d4 100644 (file)
@@ -2092,18 +2092,22 @@ static void ehci_advance_state(EHCIState *ehci, int async)
             break;
 
         case EST_ADVANCEQUEUE:
+            assert(q != NULL);
             again = ehci_state_advqueue(q);
             break;
 
         case EST_FETCHQTD:
+            assert(q != NULL);
             again = ehci_state_fetchqtd(q);
             break;
 
         case EST_HORIZONTALQH:
+            assert(q != NULL);
             again = ehci_state_horizqh(q);
             break;
 
         case EST_EXECUTE:
+            assert(q != NULL);
             again = ehci_state_execute(q);
             if (async) {
                 ehci->async_stepdown = 0;