amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>,
	amd-gfx@lists.freedesktop.org, "Bhardwaj,
	Rajneesh" <Rajneesh.Bhardwaj@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH 4/4] drm/amdkfd: fix ref count leak when pm_runtime_get_sync fails
Date: Wed, 17 Jun 2020 16:16:36 -0400	[thread overview]
Message-ID: <68e00259-d3dc-2ed8-cb66-faee4cb17716@amd.com> (raw)
In-Reply-To: <20200617190212.3519907-4-alexander.deucher@amd.com>

[+Rajneesh]

Am 2020-06-17 um 3:02 p.m. schrieb Alex Deucher:
> The call to pm_runtime_get_sync increments the counter even in case of
> failure, leading to incorrect ref count.
> In case of failure, decrement the ref count before returning.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_process.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index a9a7f5aa2710..0b4f40905f55 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -1116,8 +1116,10 @@ struct kfd_process_device *kfd_bind_process_to_device(struct kfd_dev *dev,
>  	 */
>  	if (!pdd->runtime_inuse) {
>  		err = pm_runtime_get_sync(dev->ddev->dev);
> -		if (err < 0)
> +		if (err < 0) {
> +			pm_runtime_put_autosuspend(dev->ddev->dev);
>  			return ERR_PTR(err);
> +		}
>  	}
>  
>  	err = kfd_iommu_bind_process_to_device(pdd);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2020-06-17 20:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 19:02 [PATCH 1/4] drm/amdgpu/debugfs: fix ref count leak when pm_runtime_get_sync fails Alex Deucher
2020-06-17 19:02 ` [PATCH 2/4] drm/amdgpu/pm: " Alex Deucher
2020-06-18  4:24   ` Quan, Evan
2020-06-17 19:02 ` [PATCH 3/4] drm/amdgpu/fence: " Alex Deucher
2020-06-17 20:27   ` Bhardwaj, Rajneesh
2020-06-17 19:02 ` [PATCH 4/4] drm/amdkfd: " Alex Deucher
2020-06-17 20:16   ` Felix Kuehling [this message]
2020-06-17 20:26     ` Bhardwaj, Rajneesh
2020-06-18  4:25 ` [PATCH 1/4] drm/amdgpu/debugfs: " Quan, Evan

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=68e00259-d3dc-2ed8-cb66-faee4cb17716@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Rajneesh.Bhardwaj@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.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).