<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 21, 2021 at 11:26 PM Miaoqian Lin <<a href="mailto:linmq006@gmail.com">linmq006@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Since drm_prime_pages_to_sg() function return error pointers.<br>
The drm_gem_shmem_get_sg_table() function returns error pointers too.<br>
Using IS_ERR() to check the return value to fix this.<br>
<br>
Fixes: f651c8b05542("drm/virtio: factor out the sg_table from virtio_gpu_object")<br>
Signed-off-by: Miaoqian Lin <<a href="mailto:linmq006@gmail.com" target="_blank">linmq006@gmail.com</a>><br></blockquote><div><br></div>Reviewed-by: Gurchetan Singh <<a href="mailto:gurchetansingh@chromium.org">gurchetansingh@chromium.org</a>><br><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++--<br>
 1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c<br>
index f648b0e24447..8bb80289672c 100644<br>
--- a/drivers/gpu/drm/virtio/virtgpu_object.c<br>
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c<br>
@@ -168,9 +168,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,<br>
         * since virtio_gpu doesn't support dma-buf import from other devices.<br>
         */<br>
        shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base);<br>
-       if (!shmem->pages) {<br>
+       if (IS_ERR(shmem->pages)) {<br>
                drm_gem_shmem_unpin(&bo->base.base);<br>
-               return -EINVAL;<br>
+               return PTR_ERR(shmem->pages);<br>
        }<br>
<br>
        if (use_dma_api) {<br>
-- <br>
2.17.1<br>
<br></blockquote><div><br></div><div> </div></div></div>