On Wed, Mar 23, 2022 at 4:01 AM Liu Zixian <liuzixian4@xxxxxxxxxx> wrote: > diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c > index 5b00310ac..f73352e7b 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_display.c > +++ b/drivers/gpu/drm/virtio/virtgpu_display.c > @@ -179,6 +179,8 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector) > DRM_DEBUG("add mode: %dx%d\n", width, height); > mode = drm_cvt_mode(connector->dev, width, height, 60, > false, false, false); > + if (!mode) > + return count; > mode->type |= DRM_MODE_TYPE_PREFERRED; > drm_mode_probed_add(connector, mode); > count++; Can we avoid early return here? Something like mode = drm_cvt_mode(...); if (mode) { DRM_DEBUG("add mode: %dx%d\n", width, height); mode->type |= DRM_MODE_TYPE_PREFERRED drm_mode_probed_add(connector, mode); count++; } is more future proof. > -- > 2.33.0 > _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization