Skip to content

Commit

Permalink
drm/vmwgfx/vmwgfx_drv: Fix an error path in vmw_setup_pci_resources()
Browse files Browse the repository at this point in the history
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: be4f77a ("drm/vmwgfx: Cleanup fifo mmio handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YA6FMboLhnE3uSvb@mwanda
(cherry picked from commit f3ebd4e)
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
  • Loading branch information
Dan Carpenter authored and Maarten Lankhorst committed Feb 9, 2021
1 parent 6ff92de commit 78e4ba4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,10 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,
fifo_size,
MEMREMAP_WB);

if (unlikely(dev->fifo_mem == NULL)) {
if (IS_ERR(dev->fifo_mem)) {
DRM_ERROR("Failed mapping FIFO memory.\n");
return -ENOMEM;
pci_release_regions(pdev);
return PTR_ERR(dev->fifo_mem);
}

/*
Expand Down

0 comments on commit 78e4ba4

Please sign in to comment.