]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/simpledrm: Fix an NULL vs IS_ERR() bug
authorDan Carpenter <error27@gmail.com>
Thu, 26 Jan 2023 09:28:44 +0000 (12:28 +0300)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 1 Feb 2023 10:16:46 +0000 (11:16 +0100)
The devm_memremap() function doesn't return NULL, it returns error
pointers.

Fixes: 9a10c7e6519b ("drm/simpledrm: Add support for system memory framebuffers")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/Y9JHzImRcUaa0mi1@kili
(cherry picked from commit e566507bf2f460967f53030ef84b67ef26dcaf8e)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
drivers/gpu/drm/tiny/simpledrm.c

index 2acc0eb32489caa32775a51b97063630a16325c0..63881a3754f8a0c5253388861de9e0592ecdfc58 100644 (file)
@@ -719,8 +719,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
                drm_dbg(dev, "using system memory framebuffer at %pr\n", mem);
 
                screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC);
-               if (!screen_base)
-                       return ERR_PTR(-ENOMEM);
+               if (IS_ERR(screen_base))
+                       return screen_base;
 
                iosys_map_set_vaddr(&sdev->screen_base, screen_base);
        } else {