From 0dbce4042f46475147db8a5d8cd211e1593e7043 Mon Sep 17 00:00:00 2001 From: Praveen hodagatta pranesh Date: Thu, 10 Jan 2019 18:23:58 +0800 Subject: mb/intel/kblrvp: Fix unsigned val casting of smaller size Signed-off-by: Praveen hodagatta pranesh Change-Id: I519ed4b5b403622d6bb01ad0bdd04e01dedff7d8 Reviewed-on: https://review.coreboot.org/c/30794 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/mainboard/intel/kblrvp/board_id.c | 9 +++++---- src/mainboard/intel/kblrvp/board_id.h | 4 +++- src/mainboard/intel/kblrvp/romstage.c | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mainboard/intel/kblrvp/board_id.c b/src/mainboard/intel/kblrvp/board_id.c index d4c4f535cb..a978e0ff86 100644 --- a/src/mainboard/intel/kblrvp/board_id.c +++ b/src/mainboard/intel/kblrvp/board_id.c @@ -36,12 +36,13 @@ int get_ec_boardinfo(void) } /* Get spd index */ -int get_spd_index(void) +int get_spd_index(u8 *spd_index) { int ec_info = get_ec_boardinfo(); - if (ec_info >= 0) - return ((uint16_t)ec_info >> 5) & 0x7; - + if (ec_info >= 0) { + *spd_index = ((uint16_t)ec_info >> 5) & 0x7; + return 0; + } return -1; } diff --git a/src/mainboard/intel/kblrvp/board_id.h b/src/mainboard/intel/kblrvp/board_id.h index 239b76b12b..16eab690c6 100644 --- a/src/mainboard/intel/kblrvp/board_id.h +++ b/src/mainboard/intel/kblrvp/board_id.h @@ -16,6 +16,8 @@ #ifndef _MAINBOARD_BOARD_ID_H_ #define _MAINBOARD_BOARD_ID_H_ +#include + /* Mobile Board Id 0x00 - 0xFF */ #define BOARD_ID_SKL_A0_RVP3 0x04 #define BOARD_ID_SKL_RVP7 0x0B @@ -36,7 +38,7 @@ int get_ec_boardinfo(void); /* Return spd index */ -int get_spd_index(void); +int get_spd_index(u8 *spd_index); /* Board id[15:8] */ int get_board_id(void); diff --git a/src/mainboard/intel/kblrvp/romstage.c b/src/mainboard/intel/kblrvp/romstage.c index 69c10bb9a0..8e5ffcf955 100644 --- a/src/mainboard/intel/kblrvp/romstage.c +++ b/src/mainboard/intel/kblrvp/romstage.c @@ -31,8 +31,8 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) { FSP_M_CONFIG *mem_cfg; mem_cfg = &mupd->FspmConfig; - u8 spd_index = get_spd_index(); - if ((int)spd_index < 0) + u8 spd_index; + if (get_spd_index(&spd_index) < 0) return; printk(BIOS_INFO, "SPD index %d\n", spd_index); -- cgit v1.2.3