aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNicolas Le Bayon <nicolas.le.bayon@st.com>2019-11-18 17:15:22 +0100
committerYann Gautier <yann.gautier@foss.st.com>2021-06-04 15:15:18 +0200
commitc1d732d0db2463998036c678619007da79a25b3f (patch)
treeb41239dc0f0817ec28775e1029a25cd2044731fd /drivers
parent1a2c0ff9272b34b4a4b48b4bc93ada36ab23f04e (diff)
downloadtrusted-firmware-a-c1d732d0db2463998036c678619007da79a25b3f.tar.gz
fix(io_stm32image): uninitialized variable warning
Fixes implementation against build warning reported by GCC: drivers/st/io/io_stm32image.c: In function ‘stm32image_partition_read’: drivers/st/io/io_stm32image.c:249:6: error: ‘result’ may be used uninitialized in this function [-Werror=maybe-uninitialized] int result; ^~~~~~ Actually, by construction the current implementation of function stm32image_partition_read() does not mandate result to be initialized since it always reaches the exit point with a valid value in 'result'. Yet, this change prevents compiler from complaining and is more robust against future changes in the implementation. Change-Id: I383575edb605b7535398952a5fdfc266c0068c71 Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com> Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/st/io/io_stm32image.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/st/io/io_stm32image.c b/drivers/st/io/io_stm32image.c
index 3e377cd483..48bb4d3575 100644
--- a/drivers/st/io/io_stm32image.c
+++ b/drivers/st/io/io_stm32image.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2021, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -246,7 +246,7 @@ static int stm32image_partition_size(io_entity_t *entity, size_t *length)
static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
size_t length, size_t *length_read)
{
- int result;
+ int result = -EINVAL;
uint8_t *local_buffer;
boot_api_image_header_t *header =
(boot_api_image_header_t *)first_lba_buffer;