From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Lijo Lazar <lijo.lazar@amd.com>,
Hawking Zhang <Hawking.Zhang@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Sasha Levin <sashal@kernel.org>,
christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
daniel@ffwll.ch, le.ma@amd.com, James.Zhu@amd.com,
shane.xiao@amd.com, sonny.jiang@amd.com, Likun.Gao@amd.com,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 5.15 16/19] drm/amdgpu: Add NULL checks for function pointers
Date: Mon, 11 Dec 2023 08:57:50 -0500 [thread overview]
Message-ID: <20231211135908.385694-16-sashal@kernel.org> (raw)
In-Reply-To: <20231211135908.385694-1-sashal@kernel.org>
From: Lijo Lazar <lijo.lazar@amd.com>
[ Upstream commit 81577503efb49f4ad76af22f9941d72900ef4aab ]
Check if function is implemented before making the call.
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/soc15.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 529bb6c6ac6f5..e8c0e77e1b018 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -1615,9 +1615,11 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags)
if (amdgpu_sriov_vf(adev))
*flags = 0;
- adev->nbio.funcs->get_clockgating_state(adev, flags);
+ if (adev->nbio.funcs && adev->nbio.funcs->get_clockgating_state)
+ adev->nbio.funcs->get_clockgating_state(adev, flags);
- adev->hdp.funcs->get_clock_gating_state(adev, flags);
+ if (adev->hdp.funcs && adev->hdp.funcs->get_clock_gating_state)
+ adev->hdp.funcs->get_clock_gating_state(adev, flags);
if (adev->asic_type != CHIP_ALDEBARAN) {
@@ -1633,9 +1635,11 @@ static void soc15_common_get_clockgating_state(void *handle, u32 *flags)
}
/* AMD_CG_SUPPORT_ROM_MGCG */
- adev->smuio.funcs->get_clock_gating_state(adev, flags);
+ if (adev->smuio.funcs && adev->smuio.funcs->get_clock_gating_state)
+ adev->smuio.funcs->get_clock_gating_state(adev, flags);
- adev->df.funcs->get_clockgating_state(adev, flags);
+ if (adev->df.funcs && adev->df.funcs->get_clockgating_state)
+ adev->df.funcs->get_clockgating_state(adev, flags);
}
static int soc15_common_set_powergating_state(void *handle,
--
2.42.0
next prev parent reply other threads:[~2023-12-11 14:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 13:57 [PATCH AUTOSEL 5.15 01/19] ASoC: wm8974: Correct boost mixer inputs Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 02/19] ASoC: Intel: Skylake: Fix mem leak in few functions Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 03/19] ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16 Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 04/19] ASoC: Intel: Skylake: mem leak in skl register function Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 05/19] ASoC: cs43130: Fix the position of const qualifier Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 06/19] ASoC: cs43130: Fix incorrect frame delay configuration Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 07/19] ASoC: rt5650: add mutex to avoid the jack detection failure Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 08/19] ASoC: Intel: skl_hda_dsp_generic: Drop HDMI routes when HDMI is not available Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 09/19] nouveau/tu102: flush all pdbs on vmm flush Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 10/19] ASoC: hdac_hda: Conditionally register dais for HDMI and Analog Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 11/19] net/tg3: fix race condition in tg3_reset_task() Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 12/19] ASoC: da7219: Support low DC impedance headset Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 13/19] ASoC: ops: add correct range check for limiting volume Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 14/19] nvme: introduce helper function to get ctrl state Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 15/19] mips/smp: Call rcutree_report_cpu_starting() earlier Sasha Levin
2023-12-11 13:57 ` Sasha Levin [this message]
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 17/19] drm/exynos: fix a potential error pointer dereference Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 18/19] drm/exynos: fix a wrong error checking Sasha Levin
2023-12-11 13:57 ` [PATCH AUTOSEL 5.15 19/19] hwmon: (corsair-psu) Fix probe when built-in Sasha Levin
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=20231211135908.385694-16-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Hawking.Zhang@amd.com \
--cc=James.Zhu@amd.com \
--cc=Likun.Gao@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=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=le.ma@amd.com \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shane.xiao@amd.com \
--cc=sonny.jiang@amd.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