From: OpenOCD-Gerrit <ope...@us...> - 2020-02-15 15:38:20
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 1492a103db6174bd4d6994ea3487c096aef4560d (commit) via 8105c46ba5d219345cc554fd958a65f4e26ae9ce (commit) from def7318edd6570fb5484d2a4ee19b7ac1fa39f53 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1492a103db6174bd4d6994ea3487c096aef4560d Author: Antonio Borneo <bor...@gm...> Date: Mon May 6 12:50:44 2019 +0200 coding style: use ARRAY_SIZE() when possible We have the macro ARRAY_SIZE() already available. Use it! Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types ARRAY_SIZE -f {} \; Change-Id: Ic7da9b710edf118eacb08f9e222f34208c580842 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5198 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/flash/nor/ambiqmicro.c b/src/flash/nor/ambiqmicro.c index b1e3e72a9..b41b15c07 100644 --- a/src/flash/nor/ambiqmicro.c +++ b/src/flash/nor/ambiqmicro.c @@ -253,8 +253,7 @@ static int ambiqmicro_read_part_info(struct flash_bank *bank) } - if (ambiqmicro_info->target_class < - (sizeof(ambiqmicroParts)/sizeof(ambiqmicroParts[0]))) + if (ambiqmicro_info->target_class < ARRAY_SIZE(ambiqmicroParts)) ambiqmicro_info->target_name = ambiqmicroParts[ambiqmicro_info->target_class].partname; else diff --git a/src/flash/nor/numicro.c b/src/flash/nor/numicro.c index c62af04bf..9e18136fa 100644 --- a/src/flash/nor/numicro.c +++ b/src/flash/nor/numicro.c @@ -1663,7 +1663,7 @@ static int numicro_get_cpu_type(struct target *target, const struct numicro_cpu_ LOG_INFO("Device ID: 0x%08" PRIx32 "", part_id); /* search part numbers */ - for (size_t i = 0; i < sizeof(NuMicroParts)/sizeof(NuMicroParts[0]); i++) { + for (size_t i = 0; i < ARRAY_SIZE(NuMicroParts); i++) { if (part_id == NuMicroParts[i].partid) { *cpu = &NuMicroParts[i]; LOG_INFO("Device Name: %s", (*cpu)->partname); diff --git a/src/flash/nor/psoc6.c b/src/flash/nor/psoc6.c index 386075e2c..3cdfcc424 100644 --- a/src/flash/nor/psoc6.c +++ b/src/flash/nor/psoc6.c @@ -108,7 +108,7 @@ static const struct row_region safe_sflash_regions[] = { {0x16007C00, 0x400}, /* SFLASH: TOC2 */ }; -#define SFLASH_NUM_REGIONS (sizeof(safe_sflash_regions) / sizeof(safe_sflash_regions[0])) +#define SFLASH_NUM_REGIONS ARRAY_SIZE(safe_sflash_regions) static struct working_area *g_stack_area; static struct armv7m_algorithm g_armv7m_info; diff --git a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c index 53a7e989b..678b097c9 100644 --- a/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c +++ b/src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c @@ -48,7 +48,7 @@ uint8_t usbtoxxx_abilities[USB_TO_XXX_ABILITIES_LEN]; #define usbtoxxx_get_type_name(type) \ types_name[((type) - VERSALOON_USB_TO_XXX_CMD_START) \ - % (sizeof(types_name) / sizeof(types_name[0]))] + % ARRAY_SIZE(types_name)] static uint8_t type_pre; static uint16_t usbtoxxx_buffer_index; commit 8105c46ba5d219345cc554fd958a65f4e26ae9ce Author: Antonio Borneo <bor...@gm...> Date: Mon May 6 11:29:17 2019 +0200 coding style: remove unnecessary parentheses Identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types UNNECESSARY_PARENTHESES -f {} \; then fixed manually. Change-Id: Ia2d9a0953d9b89fc87dc1195aa05c7f63c068c48 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5196 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 7f59401b1..9a1f2b16f 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -919,7 +919,7 @@ static int cortex_m_step(struct target *target, int current, * a normal step, otherwise we have to manually step over the bkpt * instruction - as such simulate a step */ if (bkpt_inst_found == false) { - if ((cortex_m->isrmasking_mode != CORTEX_M_ISRMASK_AUTO)) { + if (cortex_m->isrmasking_mode != CORTEX_M_ISRMASK_AUTO) { /* Automatic ISR masking mode off: Just step over the next * instruction, with interrupts on or off as appropriate. */ cortex_m_set_maskints_for_step(target); diff --git a/src/target/stm8.c b/src/target/stm8.c index 54a4bce26..6b03bb5a4 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -356,7 +356,7 @@ static int stm8_set_hwbreak(struct target *target, if ((comparator_list[0].type != HWBRK_EXEC) && (comparator_list[1].type != HWBRK_EXEC)) { - if ((comparator_list[0].type != comparator_list[1].type)) { + if (comparator_list[0].type != comparator_list[1].type) { LOG_ERROR("data hw breakpoints must be of same type"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } ----------------------------------------------------------------------- Summary of changes: src/flash/nor/ambiqmicro.c | 3 +-- src/flash/nor/numicro.c | 2 +- src/flash/nor/psoc6.c | 2 +- src/jtag/drivers/versaloon/usbtoxxx/usbtoxxx.c | 2 +- src/target/cortex_m.c | 2 +- src/target/stm8.c | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |