[PATCH] drm/vgem: validate vgem_device before exit operations
Daniel Vetter
daniel at ffwll.ch
Thu Sep 17 14:30:26 UTC 2020
On Thu, Sep 17, 2020 at 4:21 PM Melissa Wen <melissa.srw at gmail.com> wrote:
>
> This patch adds a check for the vgem_device before handling it.
>
> Signed-off-by: Melissa Wen <melissa.srw at gmail.com>
Seems reasonable. Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index cb884c890065..119ca887cb8a 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -472,7 +472,14 @@ static int __init vgem_init(void)
>
> static void __exit vgem_exit(void)
> {
> - struct platform_device *pdev = vgem_device->platform;
> + struct platform_device *pdev;
> +
> + if (!vgem_device) {
> + DRM_INFO("vgem_device is NULL\n");
> + return;
> + }
> +
> + pdev = vgem_device->platform;
>
> drm_dev_unregister(&vgem_device->drm);
> devres_release_group(&pdev->dev, NULL);
> --
> 2.28.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list