From a77bb32573f0c23e11a745050b15dab2300ae2b0 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 27 Feb 2023 20:21:09 +0100 Subject: soc/amd/common/block/apob/apob_cache: use enum cb_err Use enum cb_err to return an error/success state instead of an int in get_nv_rdev and get_nv_rdev_rw. Signed-off-by: Felix Held Change-Id: I73706a93bc1dbc8556e11885faf7f486c468bea9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73317 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Matt DeVillier Reviewed-by: Fred Reitberger Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/apob/apob_cache.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/soc/amd/common/block/apob/apob_cache.c b/src/soc/amd/common/block/apob/apob_cache.c index 5eab44be62..06dc5977c7 100644 --- a/src/soc/amd/common/block/apob/apob_cache.c +++ b/src/soc/amd/common/block/apob/apob_cache.c @@ -90,26 +90,26 @@ static void *get_apob_dram_address(void) return apob_src_ram; } -static int get_nv_rdev(struct region_device *r) +static enum cb_err get_nv_rdev(struct region_device *r) { if (fmap_locate_area_as_rdev(vboot_recovery_mode_enabled() ? RECOVERY_MRC_CACHE : DEFAULT_MRC_CACHE, r) < 0) { printk(BIOS_ERR, "No APOB NV region is found in flash\n"); - return -1; + return CB_ERR; } - return 0; + return CB_SUCCESS; } -static int get_nv_rdev_rw(struct region_device *r) +static enum cb_err get_nv_rdev_rw(struct region_device *r) { if (fmap_locate_area_as_rdev_rw(vboot_recovery_mode_enabled() ? RECOVERY_MRC_CACHE : DEFAULT_MRC_CACHE, r) < 0) { printk(BIOS_ERR, "No APOB NV region is found in flash\n"); - return -1; + return CB_ERR; } - return 0; + return CB_SUCCESS; } static struct apob_thread_context { @@ -146,7 +146,7 @@ void start_apob_cache_read(void) if (acpi_is_wakeup_s3()) return; - if (get_nv_rdev(&thread->apob_rdev) != 0) + if (get_nv_rdev(&thread->apob_rdev) != CB_SUCCESS) return; assert(ARRAY_SIZE(thread->buffer) == region_device_sz(&thread->apob_rdev)); @@ -210,7 +210,7 @@ static void soc_update_apob_cache(void *unused) if (apob_src_ram == NULL) return; - if (get_nv_rdev(&read_rdev) != 0) + if (get_nv_rdev(&read_rdev) != CB_SUCCESS) return; timestamp_add_now(TS_AMD_APOB_READ_START); @@ -251,7 +251,7 @@ static void soc_update_apob_cache(void *unused) apob_src_ram, apob_src_ram->size, region_device_offset(&read_rdev), region_device_sz(&read_rdev)); - if (get_nv_rdev_rw(&write_rdev) != 0) + if (get_nv_rdev_rw(&write_rdev) != CB_SUCCESS) return; timestamp_add_now(TS_AMD_APOB_ERASE_START); @@ -281,7 +281,7 @@ static void *get_apob_nv_address(void) { struct region_device rdev; - if (get_nv_rdev(&rdev) != 0) + if (get_nv_rdev(&rdev) != CB_SUCCESS) return NULL; return get_apob_from_nv_rdev(&rdev); -- cgit v1.2.3