Merge changes from topic "fix_sparse_warnings" into integration

* changes:
  fix(libc): remove __putchar alias
  fix(console): correct scopes for console symbols
  fix(auth): use NULL instead of 0 for pointer check
  fix(io): compare function pointers with NULL
  fix(fdt-wrappers): use correct prototypes
This commit is contained in:
Madhukar Pappireddy 2023-01-20 18:20:59 +01:00 committed by TrustedFirmware Code Review
commit acf455b41f
6 changed files with 20 additions and 19 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2022, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -206,9 +206,9 @@ int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
assert(cells <= 2U); assert(cells <= 2U);
if (cells == 2U) if (cells == 2U)
*(uint64_t *)value = cpu_to_fdt64(*(uint64_t *)value); *(fdt64_t *)value = cpu_to_fdt64(*(uint64_t *)value);
else else
*(uint32_t *)value = cpu_to_fdt32(*(uint32_t *)value); *(fdt32_t *)value = cpu_to_fdt32(*(uint32_t *)value);
len = (int)cells * 4; len = (int)cells * 4;
@ -392,7 +392,7 @@ int fdt_get_stdout_node_offset(const void *dtb)
* to a global address with help of various helper functions. * to a global address with help of various helper functions.
******************************************************************************/ ******************************************************************************/
static bool fdtw_xlat_hit(const uint32_t *value, int child_addr_size, static bool fdtw_xlat_hit(const fdt32_t *value, int child_addr_size,
int parent_addr_size, int range_size, uint64_t base_address, int parent_addr_size, int range_size, uint64_t base_address,
uint64_t *translated_addr) uint64_t *translated_addr)
{ {
@ -427,7 +427,7 @@ static uint64_t fdtw_search_all_xlat_entries(const void *dtb,
int local_bus, uint64_t base_address) int local_bus, uint64_t base_address)
{ {
uint64_t translated_addr; uint64_t translated_addr;
const uint32_t *next_entry; const fdt32_t *next_entry;
int parent_bus_node, nxlat_entries, length; int parent_bus_node, nxlat_entries, length;
int self_addr_cells, parent_addr_cells, self_size_cells, ncells_xlat; int self_addr_cells, parent_addr_cells, self_size_cells, ncells_xlat;
@ -460,7 +460,7 @@ static uint64_t fdtw_search_all_xlat_entries(const void *dtb,
assert(nxlat_entries > 0); assert(nxlat_entries > 0);
next_entry = (const uint32_t *)ranges_prop->data; next_entry = (const fdt32_t *)ranges_prop->data;
/* Iterate over the entries in the "ranges" */ /* Iterate over the entries in the "ranges" */
for (int i = 0; i < nxlat_entries; i++) { for (int i = 0; i < nxlat_entries; i++) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -484,7 +484,7 @@ static int get_auth_param(const auth_param_type_desc_t *type_desc,
rc = get_ext(type_desc->cookie, param, param_len); rc = get_ext(type_desc->cookie, param, param_len);
break; break;
case AUTH_PARAM_PUB_KEY: case AUTH_PARAM_PUB_KEY:
if (type_desc->cookie != 0) { if (type_desc->cookie != NULL) {
/* Get public key from extension */ /* Get public key from extension */
rc = get_ext(type_desc->cookie, param, param_len); rc = get_ext(type_desc->cookie, param, param_len);
} else { } else {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -11,7 +11,7 @@
#include <drivers/console.h> #include <drivers/console.h>
console_t *console_list; console_t *console_list;
uint8_t console_state = CONSOLE_FLAG_BOOT; static uint8_t console_state = CONSOLE_FLAG_BOOT;
IMPORT_SYM(console_t *, __STACKS_START__, stacks_start) IMPORT_SYM(console_t *, __STACKS_START__, stacks_start)
IMPORT_SYM(console_t *, __STACKS_END__, stacks_end) IMPORT_SYM(console_t *, __STACKS_END__, stacks_end)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -271,7 +271,7 @@ static int block_read(io_entity_t *entity, uintptr_t buffer, size_t length,
block_size = cur->dev_spec->block_size; block_size = cur->dev_spec->block_size;
assert((length <= cur->size) && assert((length <= cur->size) &&
(length > 0U) && (length > 0U) &&
(ops->read != 0)); (ops->read != NULL));
/* /*
* We don't know the number of bytes that we are going * We don't know the number of bytes that we are going
@ -383,8 +383,8 @@ static int block_write(io_entity_t *entity, const uintptr_t buffer,
block_size = cur->dev_spec->block_size; block_size = cur->dev_spec->block_size;
assert((length <= cur->size) && assert((length <= cur->size) &&
(length > 0U) && (length > 0U) &&
(ops->read != 0) && (ops->read != NULL) &&
(ops->write != 0)); (ops->write != NULL));
/* /*
* We don't know the number of bytes that we are going * We don't know the number of bytes that we are going

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -48,6 +48,8 @@ typedef struct console {
/* Additional private driver data may follow here. */ /* Additional private driver data may follow here. */
} console_t; } console_t;
extern console_t *console_list;
/* offset macro assertions for console_t */ /* offset macro assertions for console_t */
#include <drivers/console_assertions.h> #include <drivers/console_assertions.h>

View file

@ -1,14 +1,13 @@
/* /*
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2023, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <stdio.h> #include <stdio.h>
int __putchar(int c) #pragma weak putchar
int putchar(int c)
{ {
return c; return c;
} }
int putchar(int c) __attribute__((weak,alias("__putchar")));