aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_crat.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_crat.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index 3de5e14c5ae3..d7f67620f57b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -774,6 +774,7 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
774 struct acpi_table_header *crat_table; 774 struct acpi_table_header *crat_table;
775 acpi_status status; 775 acpi_status status;
776 void *pcrat_image; 776 void *pcrat_image;
777 int rc = 0;
777 778
778 if (!crat_image) 779 if (!crat_image)
779 return -EINVAL; 780 return -EINVAL;
@@ -798,14 +799,17 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
798 } 799 }
799 800
800 pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL); 801 pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
801 if (!pcrat_image) 802 if (!pcrat_image) {
802 return -ENOMEM; 803 rc = -ENOMEM;
804 goto out;
805 }
803 806
804 memcpy(pcrat_image, crat_table, crat_table->length); 807 memcpy(pcrat_image, crat_table, crat_table->length);
805 *crat_image = pcrat_image; 808 *crat_image = pcrat_image;
806 *size = crat_table->length; 809 *size = crat_table->length;
807 810out:
808 return 0; 811 acpi_put_table(crat_table);
812 return rc;
809} 813}
810 814
811/* Memory required to create Virtual CRAT. 815/* Memory required to create Virtual CRAT.
@@ -988,6 +992,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
988 CRAT_OEMID_LENGTH); 992 CRAT_OEMID_LENGTH);
989 memcpy(crat_table->oem_table_id, acpi_table->oem_table_id, 993 memcpy(crat_table->oem_table_id, acpi_table->oem_table_id,
990 CRAT_OEMTABLEID_LENGTH); 994 CRAT_OEMTABLEID_LENGTH);
995 acpi_put_table(acpi_table);
991 } 996 }
992 crat_table->total_entries = 0; 997 crat_table->total_entries = 0;
993 crat_table->num_domains = 0; 998 crat_table->num_domains = 0;