drm/virtio: checking for NULL instead of IS_ERR
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 10 Jun 2015 19:27:11 +0000 (22:27 +0300)
committerDave Airlie <airlied@redhat.com>
Thu, 11 Jun 2015 03:16:29 +0000 (13:16 +1000)
virtio_gpu_alloc_object() returns an error pointer, it never returns
NULL.

Fixes: dc5698e80cf7 ('Add virtio gpu driver.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/virtio/virtgpu_fb.c

index 25bf333d5a45cbc9c721836b0da7d9392dad3d50..df198d9e770c2f61882c9a1bdae771f8c9378f54 100644 (file)
@@ -299,8 +299,8 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
 
        size = mode_cmd.pitches[0] * mode_cmd.height;
        obj = virtio_gpu_alloc_object(dev, size, false, true);
-       if (!obj)
-               return -ENOMEM;
+       if (IS_ERR(obj))
+               return PTR_ERR(obj);
 
        virtio_gpu_resource_id_get(vgdev, &resid);
        virtio_gpu_cmd_create_resource(vgdev, resid, format,