summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-06-23 18:49:26 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-06-26 12:02:51 +0000
commit50cbb933a312c4fd57b8f3bdf6fc938e4179f2f0 (patch)
tree4f3cc94a4db8568da8d4f80b221b5e72f32b7dd1 /src/soc/amd/common
parent634c7a4450ff00b5eeff792822b9ac6fe12b3570 (diff)
soc/amd/common/block/acpi/ivrs: use memset on ivhd_[11,40]
Assign the current address casted to acpi_ivrs_ivhd[11,40]_t pointer to *ivhd_[11,40] at the beginning of acpi_fill_ivrs[11,40] and then use memset on *ivhd_[11,40] to zero-initialize the structs. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I70b12fee99d6c71318189ac35e615589a4c8c629 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76077 Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/acpi/ivrs.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c
index d2080e9f36..d5a409f2eb 100644
--- a/src/soc/amd/common/block/acpi/ivrs.c
+++ b/src/soc/amd/common/block/acpi/ivrs.c
@@ -200,11 +200,10 @@ static unsigned long acpi_ivhd_misc(unsigned long current, struct device *dev)
static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *ivhd,
struct device *nb_dev, struct device *iommu_dev)
{
- acpi_ivrs_ivhd40_t *ivhd_40;
+ acpi_ivrs_ivhd40_t *ivhd_40 = (acpi_ivrs_ivhd40_t *)current;
unsigned long current_backup;
- memset((void *)current, 0, sizeof(acpi_ivrs_ivhd40_t));
- ivhd_40 = (acpi_ivrs_ivhd40_t *)current;
+ memset(ivhd_40, 0, sizeof(acpi_ivrs_ivhd40_t));
/* Enable EFR */
ivhd_40->type = IVHD_BLOCK_TYPE_FULL__ACPI_HID;
@@ -253,7 +252,7 @@ static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *i
static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *ivhd,
struct device *nb_dev, struct device *iommu_dev)
{
- acpi_ivrs_ivhd11_t *ivhd_11;
+ acpi_ivrs_ivhd11_t *ivhd_11 = (acpi_ivrs_ivhd11_t *)current;
ivhd11_iommu_attr_t *ivhd11_attr_ptr;
unsigned long current_backup;
@@ -261,8 +260,7 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *i
* In order to utilize all features, firmware should expose type 11h
* IVHD which supersedes the type 10h.
*/
- memset((void *)current, 0, sizeof(acpi_ivrs_ivhd11_t));
- ivhd_11 = (acpi_ivrs_ivhd11_t *)current;
+ memset(ivhd_11, 0, sizeof(acpi_ivrs_ivhd11_t));
/* Enable EFR */
ivhd_11->type = IVHD_BLOCK_TYPE_FULL__FIXED;