Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()

If the kmemdup() fails then this should return a negative error code
but it currently returns success

Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dan Carpenter and committed by
Alex Deucher
90cb3d8a f689f2be

+3 -1
+3 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
··· 519 519 pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups), 520 520 GFP_KERNEL); 521 521 522 - if (!pmu_entry->pmu.attr_groups) 522 + if (!pmu_entry->pmu.attr_groups) { 523 + ret = -ENOMEM; 523 524 goto err_attr_group; 525 + } 524 526 525 527 snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix, 526 528 adev_to_drm(pmu_entry->adev)->primary->index);