Hi Dan,
I see the problem now, thanks for the patch.

> -----Original Message-----
> From: Dan Carpenter <dan.carpen...@oracle.com>
> Sent: Friday, November 20, 2020 12:11 AM
> To: Chrisanthus, Anitha <anitha.chrisant...@intel.com>
> Cc: Dea, Edmund J <edmund.j....@intel.com>; David Airlie <airl...@linux.ie>;
> Daniel Vetter <dan...@ffwll.ch>; Sam Ravnborg <s...@ravnborg.org>; dri-
> de...@lists.freedesktop.org; kernel-janit...@vger.kernel.org
> Subject: [PATCH v2] drm/kmb: Fix possible oops in probe error handling
> 
> If kmb_dsi_init() fails the "kmb->kmb_dsi" variable is an error pointer.
> The kernel will Oops when we pass it to kmb_dsi_host_unregister().
> 
> Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
> ---
> v2: write a better commit message
> 
>  drivers/gpu/drm/kmb/kmb_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> index a31a840ce634..8c43b136765c 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -504,7 +504,7 @@ static int kmb_probe(struct platform_device *pdev)
>       if (IS_ERR(kmb->kmb_dsi)) {
>               drm_err(&kmb->drm, "failed to initialize DSI\n");
>               ret = PTR_ERR(kmb->kmb_dsi);
> -             goto err_free1;
> +             goto err_clear_drvdata;
>       }
> 
>       kmb->kmb_dsi->dev = &dsi_pdev->dev;
> @@ -540,8 +540,9 @@ static int kmb_probe(struct platform_device *pdev)
>       drm_crtc_cleanup(&kmb->crtc);
>       drm_mode_config_cleanup(&kmb->drm);
>   err_free1:
> -     dev_set_drvdata(dev, NULL);
>       kmb_dsi_host_unregister(kmb->kmb_dsi);
> + err_clear_drvdata:
We still need to unregister the dsi_host that was registered in this call 
kmb_dsi_host_bridge_init.
This will require more changes in kmb_dsi_host_unregister and/or separate out 
mipi_dsi_host_unregister.
FYI - I will be out all of next week, will be back the next Monday.
> +     dev_set_drvdata(dev, NULL);
> 
>       return ret;
>  }
> --
> 2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to