On Mon, Mar 02, 2020 at 11:26:15PM +0100, Daniel Vetter wrote:
> It's right above the drm_dev_put().
> 
> This is made possible by a preceeding patch which added a drmm_
> cleanup action to drm_mode_config_init(), hence all we need to do to
> ensure that drm_mode_config_cleanup() is run on final drm_device
> cleanup is check the new error code for _init().
> 
> Aside: This driver gets its devm_ stuff all wrong wrt drm_device and
> anything hanging off that. Not the only one unfortunately.
> 
> v2: Explain why this cleanup is possible (Laurent).
> 
> v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas)
> 
> Cc: Sam Ravnborg <s...@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmerm...@suse.de>
> Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
> Cc: Eric Anholt <e...@anholt.net>

Acked-by: Sam Ravnborg <s...@ravnborg.org>

> ---
>  drivers/gpu/drm/pl111/pl111_drv.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/pl111/pl111_drv.c 
> b/drivers/gpu/drm/pl111/pl111_drv.c
> index aa8aa8d9e405..f9ca0f3edbbb 100644
> --- a/drivers/gpu/drm/pl111/pl111_drv.c
> +++ b/drivers/gpu/drm/pl111/pl111_drv.c
> @@ -90,10 +90,13 @@ static int pl111_modeset_init(struct drm_device *dev)
>       struct drm_panel *panel = NULL;
>       struct drm_bridge *bridge = NULL;
>       bool defer = false;
> -     int ret = 0;
> +     int ret;
>       int i;
>  
> -     drm_mode_config_init(dev);
> +     ret = drmm_mode_config_init(dev);
> +     if (ret)
> +             return ret;
> +
>       mode_config = &dev->mode_config;
>       mode_config->funcs = &mode_config_funcs;
>       mode_config->min_width = 1;
> @@ -154,7 +157,7 @@ static int pl111_modeset_init(struct drm_device *dev)
>                                                   DRM_MODE_CONNECTOR_Unknown);
>               if (IS_ERR(bridge)) {
>                       ret = PTR_ERR(bridge);
> -                     goto out_config;
> +                     goto finish;
>               }
>       } else if (bridge) {
>               dev_info(dev->dev, "Using non-panel bridge\n");
> @@ -197,8 +200,6 @@ static int pl111_modeset_init(struct drm_device *dev)
>  out_bridge:
>       if (panel)
>               drm_panel_bridge_remove(bridge);
> -out_config:
> -     drm_mode_config_cleanup(dev);
>  finish:
>       return ret;
>  }
> @@ -343,7 +344,6 @@ static int pl111_amba_remove(struct amba_device *amba_dev)
>       drm_dev_unregister(drm);
>       if (priv->panel)
>               drm_panel_bridge_remove(priv->bridge);
> -     drm_mode_config_cleanup(drm);
>       drm_dev_put(drm);
>       of_reserved_mem_device_release(dev);
>  
> -- 
> 2.24.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to