dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Ilija Hadzic <ilijahadzic@gmail.com>
Cc: stable@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm: restore open_count if drm_setup fails
Date: Tue, 30 Oct 2012 14:51:39 +0100	[thread overview]
Message-ID: <508FDB6B.6030209@vmware.com> (raw)
In-Reply-To: <1351532101-8523-1-git-send-email-ihadzic@research.bell-labs.com>

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

On 10/29/2012 06:35 PM, Ilija Hadzic wrote:
> If drm_setup (called at first open) fails, the whole
> open call has failed, so we should not keep the
> open_count incremented.
>
> Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
> Cc: stable@vger.kernel.org
> ---
>   drivers/gpu/drm/drm_fops.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 7ef1b67..af68eca 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -135,8 +135,11 @@ int drm_open(struct inode *inode, struct file *filp)
>   	retcode = drm_open_helper(inode, filp, dev);
>   	if (!retcode) {
>   		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
> -		if (!dev->open_count++)
> +		if (!dev->open_count++) {
>   			retcode = drm_setup(dev);
> +			if (retcode)
> +				dev->open_count--;
> +		}
>   	}
>   	if (!retcode) {
>   		mutex_lock(&dev->struct_mutex);

      parent reply	other threads:[~2012-10-30 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 17:35 [PATCH 1/2] drm: restore open_count if drm_setup fails Ilija Hadzic
2012-10-29 17:35 ` [PATCH 2/2] drm: set dev_mapping before calling drm_open_helper Ilija Hadzic
2012-10-30 13:54   ` Thomas Hellstrom
2012-10-30 13:51 ` Thomas Hellstrom [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=508FDB6B.6030209@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ilijahadzic@gmail.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).