[PATCH 3/6] drm/virtio: Open-code drm_simple_encoder_init()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Sun May 31 01:00:54 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the return value of drm_encoder_init() is ignored, meaning failures during initialization go undetected and could lead to a kernel panic or oops.
--

commit 2aea64f30defed1555346f1f9a6d96e4b1c548c9
Author: Naman Arora <namanarora029 at gmail.com>

drm/virtio: Open-code drm_simple_encoder_init()

This commit replaces the drm_simple_encoder_init() wrapper with an open-coded
drm_encoder_init() in the virtio driver to remove the dependency on the
drm_simple_kms_helper.

> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c

[ ... ]

> @@ -306,7 +309,8 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
>  	if (vgdev->has_edid)
>  		drm_connector_attach_edid_property(connector);
>  
> -	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
> +	drm_encoder_init(dev, encoder, &virtio_gpu_drm_encoder_funcs,
> +			 DRM_MODE_ENCODER_VIRTUAL, NULL);

[Severity: High]
This isn't a bug introduced by this patch, but should the return value of
drm_encoder_init() be checked in vgdev_output_init() here?

If drm_encoder_init() fails (for example, returning -ENOMEM if allocating
the encoder name fails), the error is ignored. Does this allow the code to
proceed and attach an incompletely initialized encoder to the connector,
potentially leading to a NULL pointer dereference or crash later when the DRM
core interacts with it?

>  	drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
>  	encoder->possible_crtcs = 1 << index;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260531074627.8936-1-namanarora029@gmail.com?part=3



More information about the linux-amlogic mailing list