[PATCH] drm/simpledrm: Fix an NULL vs IS_ERR() bug

Thomas Zimmermann tzimmermann at suse.de
Thu Jan 26 12:52:04 UTC 2023



Am 26.01.23 um 10:28 schrieb Dan Carpenter:
> 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 at gmail.com>

Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>

> ---
>   drivers/gpu/drm/tiny/simpledrm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 2acc0eb32489..63881a3754f8 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -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 {

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230126/6faba2eb/attachment.sig>


More information about the dri-devel mailing list