[PATCH RESEND] virtio: fix error handling in virtio_gpu_object_shmem_init

Liu Zixian liuzixian4 at huawei.com
Tue Jul 26 13:33:09 UTC 2022


The comment on drm_gem_shmem_get_sg_table have been corrected, see
https://lore.kernel.org/dri-devel/20220718015357.1722-1-liuzixian4@huawei.com/t/#u

Signed-off-by: chenhaixiang <chenhaixiang3 at huawei.com>
Signed-off-by: Liu Zixian <liuzixian4 at huawei.com>
---
 drivers/gpu/drm/virtio/virtgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
index f293e6ad5..a3681b5c8 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -168,7 +168,8 @@ 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);
-	if (!shmem->pages) {
+	if (IS_ERR(shmem->pages)) {
+		shmem->pages = NULL;
 		drm_gem_shmem_unpin(&bo->base);
 		return -EINVAL;
 	}
-- 
2.33.0



More information about the dri-devel mailing list