[RESEND PATCH] drm/virtio: check return value of vgdev_output_init()

shechenglong <[email protected]>
Newsgroups gmane.linux.kernel.virtualization,gmane.comp.video.dri.devel,gmane.linux.kernel
Message-ID <[email protected]>
The return value of vgdev_output_init(), called by
virtio_gpu_modeset_init(), is not checked. As a result, modeset
initialization continues even if an output fails to initialize.

check the return value and return the error to the caller.

Signed-off-by: shechenglong <[email protected]>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 44ffffec550f..f2b98d018c1e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -378,8 +378,11 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev)

    vgdev->ddev->mode_config.fb_modifiers_not_supported = true;

-   for (i = 0 ; i < vgdev->num_scanouts; ++i)
-       vgdev_output_init(vgdev, i);
+   for (i = 0; i < vgdev->num_scanouts; ++i) {
+       ret = vgdev_output_init(vgdev, i);
+       if (ret)
+           return ret;
+   }

    ret = drm_vblank_init(vgdev->ddev, vgdev->num_scanouts);
    if (ret)
--
2.33.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.