mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
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>
This commit is contained in:
parent
50151b7f1c
commit
8332f1aaf5
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user