From cd666d992de9db8f207d997a6a65373904785a09 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 29 Nov 2019 12:14:30 +0100 Subject: lib/imd_cbmem: Remove indirection through cbmem_get_imd() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It always returns the same pointer so why not use the pointer directly? Change-Id: Ib5a13edc7f3ab05c3baf9956ab67031507bdddc1 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/37360 Reviewed-by: Kyösti Mälkki Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/lib/imd_cbmem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c index 6fd48d57dd..d7f7d20f25 100644 --- a/src/lib/imd_cbmem.c +++ b/src/lib/imd_cbmem.c @@ -43,11 +43,7 @@ void *cbmem_top(void) } -static inline struct imd *cbmem_get_imd(void) -{ - static struct imd imd_cbmem; - return &imd_cbmem; -} +static struct imd imd_cbmem; static inline const struct cbmem_entry *imd_to_cbmem(const struct imd_entry *e) { @@ -75,7 +71,7 @@ static struct imd *imd_init_backing(struct imd *backing) { struct imd *imd; - imd = cbmem_get_imd(); + imd = &imd_cbmem; if (imd != NULL) return imd; @@ -288,7 +284,7 @@ void cbmem_add_bootmem(void) void cbmem_get_region(void **baseptr, size_t *size) { - imd_region_used(cbmem_get_imd(), baseptr, size); + imd_region_used(&imd_cbmem, baseptr, size); } #if ENV_PAYLOAD_LOADER || (CONFIG(EARLY_CBMEM_LIST) \ @@ -314,7 +310,7 @@ void cbmem_add_records_to_cbtable(struct lb_header *header) struct imd_cursor cursor; struct imd *imd; - imd = cbmem_get_imd(); + imd = &imd_cbmem; if (imd_cursor_init(imd, &cursor)) return; -- cgit v1.2.3