Commit 78e4ba40 authored by Dan Carpenter's avatar Dan Carpenter Committed by Maarten Lankhorst

drm/vmwgfx/vmwgfx_drv: Fix an error path in vmw_setup_pci_resources()

The devm_memremap() function never returns NULL, it returns error
pointers so the test needs to be fixed.  Also we need to call
pci_release_regions() to avoid a memory leak.

Fixes: be4f77ac ("drm/vmwgfx: Cleanup fifo mmio handling")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarZack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YA6FMboLhnE3uSvb@mwanda
(cherry picked from commit f3ebd4e6)
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent 6ff92def
...@@ -668,9 +668,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev, ...@@ -668,9 +668,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,
fifo_size, fifo_size,
MEMREMAP_WB); MEMREMAP_WB);
if (unlikely(dev->fifo_mem == NULL)) { if (IS_ERR(dev->fifo_mem)) {
DRM_ERROR("Failed mapping FIFO memory.\n"); DRM_ERROR("Failed mapping FIFO memory.\n");
return -ENOMEM; pci_release_regions(pdev);
return PTR_ERR(dev->fifo_mem);
} }
/* /*
......
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