Gurchetan Singh
2022-Jan-07 23:34 UTC
[PATCH] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init
On Tue, Dec 21, 2021 at 11:26 PM Miaoqian Lin <linmq006 at gmail.com> wrote:> Since drm_prime_pages_to_sg() function return error pointers. > The drm_gem_shmem_get_sg_table() function returns error pointers too. > Using IS_ERR() to check the return value to fix this. > > Fixes: f651c8b05542("drm/virtio: factor out the sg_table from > virtio_gpu_object") > Signed-off-by: Miaoqian Lin <linmq006 at gmail.com> >Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>> --- > drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c > b/drivers/gpu/drm/virtio/virtgpu_object.c > index f648b0e24447..8bb80289672c 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_object.c > +++ b/drivers/gpu/drm/virtio/virtgpu_object.c > @@ -168,9 +168,9 @@ static int virtio_gpu_object_shmem_init(struct > virtio_gpu_device *vgdev, > * since virtio_gpu doesn't support dma-buf import from other > devices. > */ > shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base); > - if (!shmem->pages) { > + if (IS_ERR(shmem->pages)) { > drm_gem_shmem_unpin(&bo->base.base); > - return -EINVAL; > + return PTR_ERR(shmem->pages); > } > > if (use_dma_api) { > -- > 2.17.1 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20220107/b6688643/attachment.html>