aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx
diff options
context:
space:
mode:
authorQiheng Lin <linqiheng@huawei.com>2021-05-14 16:28:12 +0800
committerZack Rusin <zackr@vmware.com>2021-05-14 14:39:14 -0400
commit527a9471878e619add51825640a76d9777218445 (patch)
tree8dd5c2ada64f364424ccc0418cd035a4f23e145e /drivers/gpu/drm/vmwgfx
parentdrm/vmwgfx: Fix memory allocation check and a leak of object fifo (diff)
downloadlinux-dev-527a9471878e619add51825640a76d9777218445.tar.xz
linux-dev-527a9471878e619add51825640a76d9777218445.zip
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: Hulk Robot <hulkci@huawei.com> Signed-off-by: Qiheng Lin <linqiheng@huawei.com> Signed-off-by: Zack Rusin <zackr@vmware.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210514082812.1697-1-linqiheng@huawei.com
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 5cf3a5bf539f..6f5ea00973e0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -719,10 +719,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,
dev->rmmio = devm_ioremap(dev->drm.dev,
rmmio_start,
rmmio_size);
- if (IS_ERR(dev->rmmio)) {
+ if (!dev->rmmio) {
DRM_ERROR("Failed mapping registers mmio memory.\n");
pci_release_regions(pdev);
- return PTR_ERR(dev->rmmio);
+ return -ENOMEM;
}
} else if (pci_id == VMWGFX_PCI_ID_SVGA2) {
dev->io_start = pci_resource_start(pdev, 0);