]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/xen-front: fix xen_drm_front_shbuf_alloc() error handling
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 8 May 2018 09:27:39 +0000 (12:27 +0300)
committerOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Tue, 8 May 2018 11:09:52 +0000 (14:09 +0300)
The xen_drm_front_shbuf_alloc() function was returning a mix of error
pointers and NULL and the the caller wasn't checking correctly.  I've
changed it to always return error pointer consistently.

Fixes: c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180508092739.GB661@mwanda
drivers/gpu/drm/xen/xen_drm_front.c
drivers/gpu/drm/xen/xen_drm_front_shbuf.c

index 8615e8522c7a8ea396a89b0d302871402d0b77ba..378cb7ce0db531adeff8b3817c606105eb9e50d5 100644 (file)
@@ -188,8 +188,8 @@ int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info,
        buf_cfg.be_alloc = front_info->cfg.be_alloc;
 
        shbuf = xen_drm_front_shbuf_alloc(&buf_cfg);
-       if (!shbuf)
-               return -ENOMEM;
+       if (IS_ERR(shbuf))
+               return PTR_ERR(shbuf);
 
        ret = dbuf_add_to_list(front_info, shbuf, dbuf_cookie);
        if (ret < 0) {
index d5705251a0d647a292e7d64a3e0e7c72918a1a4e..8099cb343ae3bef389a2718c1fc34f50c737c73f 100644 (file)
@@ -383,7 +383,7 @@ xen_drm_front_shbuf_alloc(struct xen_drm_front_shbuf_cfg *cfg)
 
        buf = kzalloc(sizeof(*buf), GFP_KERNEL);
        if (!buf)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        if (cfg->be_alloc)
                buf->ops = &backend_ops;