From: "Christian König" <christian.koenig@amd.com>
To: Igor Artemiev <Igor.A.Artemiev@mcst.ru>,
Alex Deucher <alexander.deucher@amd.com>
Cc: Xinhui Pan <Xinhui.Pan@amd.com>, David Airlie <airlied@gmail.com>,
Kenneth Feng <kenneth.feng@amd.com>,
Simona Vetter <simona@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH] drm/amd/pm: check return value of amdgpu_irq_add_id()
Date: Tue, 1 Oct 2024 13:14:33 +0200 [thread overview]
Message-ID: <7b3ea9a6-575e-4fe5-98d9-6e53803188fa@amd.com> (raw)
In-Reply-To: <20241001105727.1582368-1-Igor.A.Artemiev@mcst.ru>
Am 01.10.24 um 12:57 schrieb Igor Artemiev:
> amdgpu_irq_ad_id() may fail and the irq handlers will not be registered.
> This patch adds error code check.
>
> Found by Linux Verification Center (linuxtesting.org) with static
> analysis tool SVACE.
>
> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
> ---
> .../drm/amd/pm/powerplay/hwmgr/smu_helper.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
> index 79a566f3564a..109df1039d5c 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c
> @@ -647,28 +647,41 @@ int smu9_register_irq_handlers(struct pp_hwmgr *hwmgr)
> {
> struct amdgpu_irq_src *source =
> kzalloc(sizeof(struct amdgpu_irq_src), GFP_KERNEL);
> + int ret;
>
> if (!source)
> return -ENOMEM;
>
> source->funcs = &smu9_irq_funcs;
>
> - amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
> + ret = amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
The cast to struct amdgpu_device should probably be removed.
> SOC15_IH_CLIENTID_THM,
> THM_9_0__SRCID__THM_DIG_THERM_L2H,
> source);
And the parameters indented to the new opening of the (.
Regards,
Christian.
> - amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
> + if (ret)
> + goto err;
> +
> + ret = amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
> SOC15_IH_CLIENTID_THM,
> THM_9_0__SRCID__THM_DIG_THERM_H2L,
> source);
> + if (ret)
> + goto err;
>
> /* Register CTF(GPIO_19) interrupt */
> - amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
> + ret = amdgpu_irq_add_id((struct amdgpu_device *)(hwmgr->adev),
> SOC15_IH_CLIENTID_ROM_SMUIO,
> SMUIO_9_0__SRCID__SMUIO_GPIO19,
> source);
> + if (ret)
> + goto err;
>
> return 0;
> +
> +err:
> + kfree(source);
> +
> + return ret;
> }
>
> void *smu_atom_get_data_table(void *dev, uint32_t table, uint16_t *size,
next prev parent reply other threads:[~2024-10-01 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 10:57 Igor Artemiev
2024-10-01 11:14 ` Christian König [this message]
2024-10-02 13:01 ` [PATCH v2] " Igor Artemiev
2024-10-02 17:58 ` Alex Deucher
2024-10-03 13:38 ` [lvc-project] " Fedor Pchelkin
2024-10-03 14:30 ` Alex Deucher
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=7b3ea9a6-575e-4fe5-98d9-6e53803188fa@amd.com \
--to=christian.koenig@amd.com \
--cc=Igor.A.Artemiev@mcst.ru \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kenneth.feng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=simona@ffwll.ch \
/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
all inboxes | Powered by JetHome®