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.

Tracked-On: #1479
Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Liang Yang 2018-10-12 10:24:34 +08:00 committed by wenlingz
parent 1568a4c095
commit 84c0c87842
1 changed files with 4 additions and 4 deletions

View File

@ -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++;