Remove several warnings reported with W=2
authorAmbroise Vincent <ambroise.vincent@arm.com>
Thu, 14 Feb 2019 09:48:21 +0000 (09:48 +0000)
committerAmbroise Vincent <ambroise.vincent@arm.com>
Mon, 1 Apr 2019 09:43:42 +0000 (10:43 +0100)
Improved support for W=2 compilation flag by solving some nested-extern
and sign-compare warnings.

The libraries are compiling with warnings (which turn into errors with
the Werror flag).

Outside of libraries, some warnings cannot be fixed.

Change-Id: I06b1923857f2a6a50e93d62d0274915b268cef05
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
12 files changed:
bl1/bl1_fwu.c
drivers/arm/css/scmi/scmi_ap_core_proto.c
drivers/arm/css/scmi/scmi_common.c
drivers/arm/css/scmi/scmi_pwr_dmn_proto.c
drivers/arm/css/scmi/scmi_sys_pwr_proto.c
drivers/arm/css/scp/css_pm_scmi.c
drivers/arm/sp804/sp804_delay_timer.c
drivers/auth/auth_mod.c
drivers/console/multi_console.c
lib/semihosting/semihosting.c
plat/arm/board/juno/juno_bl1_setup.c
services/std_svc/spm/spm_buffers.c

index 57a86aea8eb7d1cf37871380a1aa1dbce227849c..c2330163776048ea590ba7447cfab9a88db3740e 100644 (file)
@@ -52,9 +52,6 @@ __dead2 static void bl1_fwu_done(void *client_cookie, void *reserved);
  */
 static unsigned int sec_exec_image_id = INVALID_IMAGE_ID;
 
-/* Authentication status of each image. */
-extern unsigned int auth_img_flags[MAX_NUMBER_IDS];
-
 /*******************************************************************************
  * Top level handler for servicing FWU SMCs.
  ******************************************************************************/
index 2caccc2b81398b1f31582a2dc1a90c9194c2c7f2..5941b87f32aa7b83d904b78dbd123d983de432c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -18,7 +18,8 @@
 int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
@@ -51,7 +52,8 @@ int scmi_ap_core_set_reset_addr(void *p, uint64_t reset_addr, uint32_t attr)
 int scmi_ap_core_get_reset_addr(void *p, uint64_t *reset_addr, uint32_t *attr)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
        uint32_t lo_addr, hi_addr;
 
index e2c353d851a373f6c39e62e8d96e8dfbd5838ddf..5b3724ace6bd1097e8d4d3b8c1fbe94e56766549 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -90,7 +90,8 @@ void scmi_put_channel(scmi_channel_t *ch)
 int scmi_proto_version(void *p, uint32_t proto_id, uint32_t *version)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
@@ -122,7 +123,8 @@ int scmi_proto_msg_attr(void *p, uint32_t proto_id,
                uint32_t command_id, uint32_t *attr)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
index 70165dec299a7d4e21258f8fe8e68293bea25657..a342aa89ea2b50b13f4cdaadae4cab92d23d5b12 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -19,7 +19,8 @@ int scmi_pwr_state_set(void *p, uint32_t domain_id,
                                        uint32_t scmi_pwr_state)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
 
        /*
         * Only asynchronous mode of `set power state` command is allowed on
@@ -59,7 +60,8 @@ int scmi_pwr_state_get(void *p, uint32_t domain_id,
                                        uint32_t *scmi_pwr_state)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
index a27c4a5d0bb662838b50337a3feada37317e8ea1..c8e62d1536d1bbbd4b5a125ef8f38c05232315b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -18,7 +18,8 @@
 int scmi_sys_pwr_state_set(void *p, uint32_t flags, uint32_t system_state)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
@@ -50,7 +51,8 @@ int scmi_sys_pwr_state_set(void *p, uint32_t flags, uint32_t system_state)
 int scmi_sys_pwr_state_get(void *p, uint32_t *system_state)
 {
        mailbox_mem_t *mbx_mem;
-       int token = 0, ret;
+       unsigned int token = 0;
+       int ret;
        scmi_channel_t *ch = (scmi_channel_t *)p;
 
        validate_scmi_channel(ch);
index 1966c44caf53e647bc08e051438b7f99211abe7e..8dbefa16bb03f323296fd23e0933536c89b0ecb6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -99,7 +99,7 @@ void css_scp_suspend(const struct psci_power_state *target_state)
                return;
        }
 #if !HW_ASSISTED_COHERENCY
-       int lvl;
+       unsigned int lvl;
        uint32_t scmi_pwr_state = 0;
        /*
         * If we reach here, then assert that power down at system power domain
@@ -145,7 +145,8 @@ void css_scp_suspend(const struct psci_power_state *target_state)
  */
 void css_scp_off(const struct psci_power_state *target_state)
 {
-       int lvl = 0, ret;
+       unsigned int lvl = 0;
+       int ret;
        uint32_t scmi_pwr_state = 0;
 
        /* At-least the CPU level should be specified to be OFF */
@@ -184,7 +185,8 @@ void css_scp_off(const struct psci_power_state *target_state)
  */
 void css_scp_on(u_register_t mpidr)
 {
-       int lvl = 0, ret, core_pos;
+       unsigned int lvl = 0;
+       int ret, core_pos;
        uint32_t scmi_pwr_state = 0;
 
        for (; lvl <= PLAT_MAX_PWR_LVL; lvl++)
index 5313fbde2d54edd256f7a0c5abbd27abfee00b0d..9c5e76286f89d331e67155849293a9384ec60356 100644 (file)
@@ -1,11 +1,12 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 #include <assert.h>
 
+#include <drivers/arm/sp804_delay_timer.h>
 #include <drivers/delay_timer.h>
 #include <lib/mmio.h>
 
index 1b8ff82bcad33d0d2a1cf51db7367a49858d9190..97e1220327b4d3e2269998a924c301233a19da0f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 #pragma weak plat_set_nv_ctr2
 
-/* Pointer to CoT */
-extern const auth_img_desc_t *const cot_desc_ptr;
-extern unsigned int auth_img_flags[MAX_NUMBER_IDS];
-
 static int cmp_auth_param_type_desc(const auth_param_type_desc_t *a,
                const auth_param_type_desc_t *b)
 {
index a135959232c3def79d96c1fe6895a69d11691dc2..b5ff88b70a5eb53b01275839cb765b25fa4ed0a2 100644 (file)
 console_t *console_list;
 uint8_t console_state = CONSOLE_FLAG_BOOT;
 
+IMPORT_SYM(console_t *, __STACKS_START__, stacks_start)
+IMPORT_SYM(console_t *, __STACKS_END__, stacks_end)
+
 int console_register(console_t *console)
 {
-       IMPORT_SYM(console_t *, __STACKS_START__, stacks_start)
-       IMPORT_SYM(console_t *, __STACKS_END__, stacks_end)
-
        /* Assert that the struct is not on the stack (common mistake). */
        assert((console < stacks_start) || (console >= stacks_end));
        /* Assert that we won't make a circle in the list. */
index ee48dbc1f7c1d71618f516bc25031232ebb235ca..051dd008bebb1fa6518305157b9af1ce00a4ae85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -160,7 +160,7 @@ long semihosting_system(char *command_line)
 long semihosting_get_flen(const char *file_name)
 {
        long file_handle;
-       size_t length;
+       long length;
 
        assert(semihosting_connection_supported());
 
index f72a6ff1af2f5251cc4b6a475272de29267537d7..33f5c47912eb20566b01cbc45d1e930188f7c863 100644 (file)
@@ -61,7 +61,7 @@ static int is_watchdog_reset(void)
  ******************************************************************************/
 int plat_arm_bl1_fwu_needed(void)
 {
-       const uint32_t *nv_flags_ptr = (const uint32_t *)V2M_SYS_NVFLAGS_ADDR;
+       const int32_t *nv_flags_ptr = (const int32_t *)V2M_SYS_NVFLAGS_ADDR;
 
        /* Check if TOC is invalid or watchdog reset happened. */
        if ((arm_io_is_toc_valid() != 1) ||
index 736b23001b2494e4b095a96c412f904b74f0c218..3e0c9496fce0244a63663f572c0d7e1d34e430f7 100644 (file)
@@ -42,7 +42,7 @@ int spm_response_add(uint16_t client_id, uint16_t handle, uint32_t token,
                }
        }
 
-       for (int i = 0; i < ARRAY_SIZE(responses); i++) {
+       for (unsigned int i = 0U; i < ARRAY_SIZE(responses); i++) {
                struct sprt_response *resp = &(responses[i]);
 
                if (resp->is_valid == 0) {