Commit 92ce719b authored by Manish Pandey's avatar Manish Pandey Committed by TrustedFirmware Code Review
Browse files

Merge changes from topic "static_analysis" into integration

* changes:
  io: io_stm32image: correct possible NULL pointer dereference
  plat/st: correctly check pwr-regulators node
  nand: stm32_fmc2_nand: correct xor_ecc.val assigned value
  plat/st: correct static analysis tool warning
  raw_nand: correct static analysis tool warning
  spi: stm32_qspi: correct static analysis issues
parents 73d39416 95433894
/*
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
*/
......@@ -365,7 +365,7 @@ static int stm32_fmc2_ham_correct(uint8_t *buffer, uint8_t *eccbuffer,
xor_ecc_2b = ecc[1] ^ eccbuffer[1];
xor_ecc_3b = ecc[2] ^ eccbuffer[2];
xor_ecc.val = 0L;
xor_ecc.val = 0U;
xor_ecc.bytes[2] = xor_ecc_3b;
xor_ecc.bytes[1] = xor_ecc_2b;
xor_ecc.bytes[0] = xor_ecc_1b;
......
......@@ -247,7 +247,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
size_t length, size_t *length_read)
{
int result;
uint8_t *local_buffer = (uint8_t *)buffer;
uint8_t *local_buffer;
boot_api_image_header_t *header =
(boot_api_image_header_t *)first_lba_buffer;
......@@ -255,6 +255,7 @@ static int stm32image_partition_read(io_entity_t *entity, uintptr_t buffer,
assert(buffer != 0U);
assert(length_read != NULL);
local_buffer = (uint8_t *)buffer;
*length_read = 0U;
while (*length_read == 0U) {
......
/*
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
*/
......@@ -12,6 +12,7 @@
#include <drivers/delay_timer.h>
#include <drivers/spi_mem.h>
#include <drivers/st/stm32_gpio.h>
#include <drivers/st/stm32_qspi.h>
#include <drivers/st/stm32mp_reset.h>
#include <lib/mmio.h>
#include <lib/utils_def.h>
......@@ -172,9 +173,8 @@ static void stm32_qspi_write_fifo(uint8_t *val, uintptr_t addr)
static int stm32_qspi_poll(const struct spi_mem_op *op)
{
void (*fifo)(uint8_t *val, uintptr_t addr);
uint32_t len = op->data.nbytes;
uint32_t len;
uint8_t *buf;
uint64_t timeout;
if (op->data.dir == SPI_MEM_DATA_IN) {
fifo = stm32_qspi_read_fifo;
......@@ -185,7 +185,8 @@ static int stm32_qspi_poll(const struct spi_mem_op *op)
buf = (uint8_t *)op->data.buf;
for (len = op->data.nbytes; len != 0U; len--) {
timeout = timeout_init_us(QSPI_FIFO_TIMEOUT_US);
uint64_t timeout = timeout_init_us(QSPI_FIFO_TIMEOUT_US);
while ((mmio_read_32(qspi_base() + QSPI_SR) &
QSPI_SR_FTF) == 0U) {
if (timeout_elapsed(timeout)) {
......
/*
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
......@@ -7,6 +7,7 @@
#ifndef DRIVERS_RAW_NAND_H
#define DRIVERS_RAW_NAND_H
#include <cdefs.h>
#include <stdint.h>
#include <drivers/nand.h>
......
/*
* Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
......@@ -92,6 +92,7 @@ uint8_t fdt_get_status(int node)
return status;
}
#if ENABLE_ASSERTIONS
/*******************************************************************************
* This function returns the address cells from the node parent.
* Returns:
......@@ -100,7 +101,7 @@ uint8_t fdt_get_status(int node)
* - a default value if undefined #address-cells property as per libfdt
* implementation.
******************************************************************************/
int fdt_get_node_parent_address_cells(int node)
static int fdt_get_node_parent_address_cells(int node)
{
int parent;
......@@ -120,7 +121,7 @@ int fdt_get_node_parent_address_cells(int node)
* - a default value if undefined #size-cells property as per libfdt
* implementation.
******************************************************************************/
int fdt_get_node_parent_size_cells(int node)
static int fdt_get_node_parent_size_cells(int node)
{
int parent;
......@@ -131,6 +132,7 @@ int fdt_get_node_parent_size_cells(int node)
return fdt_size_cells(fdt, parent);
}
#endif
/*******************************************************************************
* This function reads a value of a node property (generic use of fdt
......@@ -467,7 +469,7 @@ uint32_t dt_get_pwr_vdd_voltage(void)
}
pwr_regulators_node = fdt_subnode_offset(fdt, node, "pwr-regulators");
if (node < 0) {
if (pwr_regulators_node < 0) {
INFO("%s: Cannot read pwr-regulators node in DT\n", __func__);
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment