From: "Christian König" <christian.koenig@amd.com>
To: Chen Tao <chentao107@huawei.com>, airlied@linux.ie, daniel@ffwll.ch
Cc: alexander.deucher@amd.com, David1.Zhou@amd.com,
tom.stdenis@amd.com, Jack.Xiao@amd.com, yttao@amd.com,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed
Date: Tue, 16 Jun 2020 08:50:20 +0200 [thread overview]
Message-ID: <a8fb3d27-d0f5-d28a-d24b-63be866ef76f@amd.com> (raw)
In-Reply-To: <20200616063039.260990-1-chentao107@huawei.com>
Am 16.06.20 um 08:30 schrieb Chen Tao:
> Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
> pm_runtime_get_sync failed.
>
> Fixes: a9ffe2a983383 ("drm/amdgpu/debugfs: properly handle runtime pm")
> Signed-off-by: Chen Tao <chentao107@huawei.com>
Probably better to remove the duplication of result and r here and then
use "goto err".
Regards,
Christian
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 1a4894fa3693..bea8c36a53a4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -862,8 +862,10 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
> return -ENOMEM;
>
> r = pm_runtime_get_sync(adev->ddev->dev);
> - if (r < 0)
> + if (r < 0) {
> + kfree(data);
> return r;
> + }
>
> r = amdgpu_virt_enable_access_debugfs(adev);
> if (r < 0)
next prev parent reply other threads:[~2020-06-16 6:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 6:30 [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed Chen Tao
2020-06-16 6:30 ` [PATCH 2/2] drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed Chen Tao
2020-06-16 6:50 ` Christian König [this message]
2020-06-16 11:04 ` [PATCH 1/2] drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed chentao (AS)
2020-06-16 11:23 Markus Elfring
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=a8fb3d27-d0f5-d28a-d24b-63be866ef76f@amd.com \
--to=christian.koenig@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Jack.Xiao@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chentao107@huawei.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.stdenis@amd.com \
--cc=yttao@amd.com \
/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).