summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/swsmu/smu13
diff options
context:
space:
mode:
authorBob Zhou <bob.zhou@amd.com>2024-05-31 11:21:45 +0300
committerAlex Deucher <alexander.deucher@amd.com>2024-06-05 18:25:13 +0300
commit8332f1aaf571bec1c023a3b13ba35c86aaa2524d (patch)
tree78c3c291712a47197db88fdfe1277c8811d72297 /drivers/gpu/drm/amd/pm/swsmu/smu13
parent50151b7f1c79a09117837eb95b76c2de76841dab (diff)
downloadlinux-8332f1aaf571bec1c023a3b13ba35c86aaa2524d.tar.xz
drm/amd/pm: add missing error handling in function smu_v13_0_6_allocate_dpm_context
Check return value to avoid null pointer dereference. Signed-off-by: Bob Zhou <bob.zhou@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/swsmu/smu13')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 15c0aa0ad443..6b8decaf6427 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -451,6 +451,11 @@ static int smu_v13_0_6_allocate_dpm_context(struct smu_context *smu)
smu_dpm->dpm_policies =
kzalloc(sizeof(struct smu_dpm_policy_ctxt), GFP_KERNEL);
+ if (!smu_dpm->dpm_policies) {
+ kfree(smu_dpm->dpm_context);
+ return -ENOMEM;
+ }
+
if (!(smu->adev->flags & AMD_IS_APU)) {
policy = &(smu_dpm->dpm_policies->policies[0]);