From 44f80657fd513f91f87973407b3474ed9f634867 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 11 May 2018 11:43:52 -0600 Subject: drivers/intel/gma: honor vbt_size parameter to locate_vbt() In 4a3956d7 (drivers/intel/gma, soc/intel/common: improve cooperation) the vbt_size parameter was not honored leading to the use of unitialized variables from the caller. Instead, keep track of if the vbt is already loaded by using the size returned from the load. If it's non-zero the vbt has been loaded. BUG=b:79562868 Change-Id: Ia1c47f0d982fae74e0223922f83943c68a846aa9 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/26236 Reviewed-by: Furquan Shaikh Reviewed-by: Patrick Georgi Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/drivers/intel/gma/opregion.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index c52c06f12b..70cbccc876 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -34,14 +34,17 @@ const char *mainboard_vbt_filename(void) } static char vbt_data[8 * KiB]; -static int vbt_data_used; +static size_t vbt_data_sz; void *locate_vbt(size_t *vbt_size) { uint32_t vbtsig = 0; - if (vbt_data_used == 1) + if (vbt_data_sz != 0) { + if (vbt_size) + *vbt_size = vbt_data_sz; return (void *)vbt_data; + } const char *filename = mainboard_vbt_filename(); @@ -62,7 +65,7 @@ void *locate_vbt(size_t *vbt_size) printk(BIOS_INFO, "Found a VBT of %zu bytes after decompression\n", file_size); - vbt_data_used = 1; + vbt_data_sz = file_size; return (void *)vbt_data; } -- cgit v1.2.3