diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-01-25 11:45:37 +0300 |
---|---|---|
committer | Zack Rusin <zackr@vmware.com> | 2021-01-28 11:08:20 -0500 |
commit | f3ebd4e6b692ab7af464561410a1f05dfc850823 (patch) | |
tree | 603753b794ef84785c3b16ef361102cdaa498e74 /drivers/gpu/drm/vmwgfx | |
parent | e7cbc68a28e14c51e354f94831bd03cdf7ec6cea (diff) | |
download | linux-f3ebd4e6b692ab7af464561410a1f05dfc850823.tar.bz2 |
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: be4f77ac6884 ("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
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index b454d80c273e..22f5a9f8a44b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -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); } /* |