Commit 527a9471 authored by Qiheng Lin's avatar Qiheng Lin Committed by Zack Rusin

drm/vmwgfx: Fix return value check in vmw_setup_pci_resources()

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR().
The IS_ERR() test in the return value check should be replaced with NULL test.
After that, the error code -ENOMEM should be returned.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarQiheng Lin <linqiheng@huawei.com>
Signed-off-by: default avatarZack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210514082812.1697-1-linqiheng@huawei.com
parent 2f70cbf7
...@@ -719,10 +719,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev, ...@@ -719,10 +719,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,
dev->rmmio = devm_ioremap(dev->drm.dev, dev->rmmio = devm_ioremap(dev->drm.dev,
rmmio_start, rmmio_start,
rmmio_size); rmmio_size);
if (IS_ERR(dev->rmmio)) { if (!dev->rmmio) {
DRM_ERROR("Failed mapping registers mmio memory.\n"); DRM_ERROR("Failed mapping registers mmio memory.\n");
pci_release_regions(pdev); pci_release_regions(pdev);
return PTR_ERR(dev->rmmio); return -ENOMEM;
} }
} else if (pci_id == VMWGFX_PCI_ID_SVGA2) { } else if (pci_id == VMWGFX_PCI_ID_SVGA2) {
dev->io_start = pci_resource_start(pdev, 0); dev->io_start = pci_resource_start(pdev, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment