All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Jordan Crouse <jcrouse@codeaurora.org>
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	Sean Paul <sean@poorly.run>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH] drm/atomic: Check that the config funcs exist drm_mode_alloc
Date: Wed, 8 May 2019 10:35:19 +0200	[thread overview]
Message-ID: <20190508083519.GS17751@phenom.ffwll.local> (raw)
In-Reply-To: <1557256451-24950-1-git-send-email-jcrouse@codeaurora.org>

On Tue, May 07, 2019 at 01:14:11PM -0600, Jordan Crouse wrote:
> An error while initializing the msm driver ends up calling
> drm_atomic_helper_shutdown() without first initializing the funcs
> in mode_config. While I'm not 100% sure this isn't a ordering
> problem in msm adding a check to drm_mode_alloc seems like
> a nice and safe solution.
> 
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Hm yeah this looks a bit too much like ducttape. I think Noralf started
working on some ideas of devm-like automatic cleanup for drm stuff (we
cannot use devm, that has the wrong lifetimes, despite all the drivers
using it).

Simple fix would be to move up the assignment of config.funcs to be much
earlier in your driver load I guess.
-Daniel

> ---
> 
>  drivers/gpu/drm/drm_atomic.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 5eb4013..1729428 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -114,6 +114,9 @@ drm_atomic_state_alloc(struct drm_device *dev)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
>  
> +	if (!config->funcs)
> +		return NULL;
> +
>  	if (!config->funcs->atomic_state_alloc) {
>  		struct drm_atomic_state *state;
>  
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2019-05-08  8:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 19:14 [PATCH] drm/atomic: Check that the config funcs exist drm_mode_alloc Jordan Crouse
2019-05-08  8:35 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190508083519.GS17751@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jcrouse@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.