DM USB: xHCI: Fix a potential NULL pointer issue.
After excap pointer is assigned, it should be checked whether it's
possible to get assignment for NULL pointer or not. This patch
fixes this issue.
Acked-by: Yu Wang
@@ -4001,13 +4001,13 @@ pci_xhci_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
* ended by EXCAP_GROUP_END at last item.
*/
excap = xdev->excap_ptr;
- xdev->excapoff = excap->start;
-
if (!excap) {
- UPRINTF(LWRN, "Failed to set xHCI extended capability\r\n");
- return -1;
+ error = -1;
+ goto done;
}
+ xdev->excapoff = excap->start;
+
do {
xdev->regsend = excap->end;
excap++;
