From: Mario Limonciello <mario.limonciello@amd.com>
To: Jiang Liu <gerry@linux.alibaba.com>,
alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@gmail.com, simona@ffwll.ch,
sunil.khatri@amd.com, lijo.lazar@amd.com, Hawking.Zhang@amd.com,
xiaogang.chen@amd.com, Kent.Russell@amd.com,
shuox.liu@linux.alibaba.com, amd-gfx@lists.freedesktop.org
Subject: Re: [v4 4/5] drm/amdgpu: enhance error handling in function amdgpu_pci_probe()
Date: Fri, 10 Jan 2025 13:05:04 -0600 [thread overview]
Message-ID: <541bc316-ae05-4e6c-9c69-8838e5f87370@amd.com> (raw)
In-Reply-To: <ae5fe482d1310c5006384a6ec55438f6d31acadc.1736474822.git.gerry@linux.alibaba.com>
On 1/9/2025 20:08, Jiang Liu wrote:
> Enhance error handling in function amdgpu_pci_probe() to avoid
> possible resource leakage.
>
> Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 41d1b06be600..f8deca2f2696 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2346,16 +2346,16 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> msleep(5000);
> goto retry_init;
> } else if (ret) {
> - goto err_pci;
> + goto unload_kms;
> }
>
> ret = amdgpu_xcp_dev_register(adev, ent);
> if (ret)
> - goto err_pci;
> + goto unplug_drm;
>
> ret = amdgpu_amdkfd_drm_client_create(adev);
> if (ret)
> - goto err_pci;
> + goto deregister_xcp;
>
> /*
> * 1. don't init fbdev on hw without DCE
> @@ -2424,6 +2424,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>
> return 0;
>
> +deregister_xcp:
> + amdgpu_xcp_dev_deregister(adev);
> +unplug_drm:
> + drm_dev_unplug(ddev);
> +unload_kms:
> + amdgpu_driver_unload_kms(ddev);
> err_pci:
> pci_disable_device(pdev);
> return ret;
next prev parent reply other threads:[~2025-01-10 19:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 2:08 [v4 0/6] Fix several bugs in error handling during device probe Jiang Liu
2025-01-10 2:08 ` [v4 1/5] drm/amdgpu: clear adev->in_suspend flag when fails to suspend Jiang Liu
2025-01-10 18:57 ` Mario Limonciello
2025-01-14 3:12 ` Gerry Liu
2025-01-10 2:08 ` [v4 2/5] drm/amdxcp: introduce new API amdgpu_xcp_drm_dev_free() Jiang Liu
2025-01-10 19:02 ` Mario Limonciello
2025-01-13 4:40 ` Lazar, Lijo
2025-01-10 2:08 ` [v4 3/5] drm/amdgpu: fix use after free bug related to amdgpu_driver_release_kms() Jiang Liu
2025-01-10 19:03 ` Mario Limonciello
2025-01-10 2:08 ` [v4 4/5] drm/amdgpu: enhance error handling in function amdgpu_pci_probe() Jiang Liu
2025-01-10 19:05 ` Mario Limonciello [this message]
2025-01-10 2:08 ` [v4 5/5] drm/amdgpu: fix invalid memory access in amdgpu_fence_driver_sw_fini() Jiang Liu
2025-01-10 6:51 ` Christian König
2025-01-10 7:37 ` Gerry Liu
2025-01-10 8:19 ` Christian König
2025-01-10 19:06 ` [v4 0/6] Fix several bugs in error handling during device probe Mario Limonciello
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=541bc316-ae05-4e6c-9c69-8838e5f87370@amd.com \
--to=mario.limonciello@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Kent.Russell@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=gerry@linux.alibaba.com \
--cc=lijo.lazar@amd.com \
--cc=shuox.liu@linux.alibaba.com \
--cc=simona@ffwll.ch \
--cc=sunil.khatri@amd.com \
--cc=xiaogang.chen@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