summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh G Solanki <naresh.solanki@intel.com>2016-12-13 20:27:15 +0530
committerMartin Roth <martinroth@google.com>2016-12-14 18:58:03 +0100
commitb8a5736c07619926ebb3d50e12988d0596289717 (patch)
tree2134ab3f4572610acc121acf3832717dac6291d5
parent4134680d465b6d33e6f3e3519a137fffd26541e1 (diff)
downloadcoreboot-b8a5736c07619926ebb3d50e12988d0596289717.tar.xz
lib/spd_bin: Check return code & remove dead code
Remove dead code to address CID 1366756 Control flow issues (DEADCODE) Add return value check to address CID 1366755 Error handling issues (CHECKED_RETURN) Found-by: Coverity Scan #1366755 Found-by: Coverity Scan #1366756 Change-Id: Id02f6915ec7c6a4abfce20332c55833683e52d77 Signed-off-by: Naresh G Solanki <naresh.solanki@intel.com> Reviewed-on: https://review.coreboot.org/17838 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/lib/spd_bin.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/spd_bin.c b/src/lib/spd_bin.c
index 343d48a101..4108839858 100644
--- a/src/lib/spd_bin.c
+++ b/src/lib/spd_bin.c
@@ -117,7 +117,8 @@ int get_spd_cbfs_rdev(struct region_device *spd_rdev, u8 spd_index)
uint32_t cbfs_type = CBFS_TYPE_SPD;
- cbfs_boot_locate(&fh, "spd.bin", &cbfs_type);
+ if (cbfs_boot_locate(&fh, "spd.bin", &cbfs_type) < 0)
+ return -1;
cbfs_file_data(spd_rdev, &fh);
return rdev_chain(spd_rdev, spd_rdev, spd_index * CONFIG_DIMM_SPD_SIZE,
CONFIG_DIMM_SPD_SIZE);
@@ -152,7 +153,7 @@ static void get_spd(u8 *spd, u8 addr)
void get_spd_smbus(struct spd_block *blk)
{
- u8 i, j;
+ u8 i;
unsigned char *spd_data_ptr = car_get_var_ptr(&spd_data);
for (i = 0 ; i < CONFIG_DIMM_MAX; i++) {
@@ -161,8 +162,5 @@ void get_spd_smbus(struct spd_block *blk)
blk->spd_array[i] = spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE;
}
- for (j = i; j < CONFIG_DIMM_MAX; j++)
- blk->spd_array[j] = NULL;
-
update_spd_len(blk);
}