openocd: fix simple cases of Yoda condition
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 3 Jul 2021 14:47:35 +0000 (16:47 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Tue, 20 Jul 2021 13:55:24 +0000 (14:55 +0100)
commit28c24a5c41c47a66e9310912f88148814f730a25
tree803cf52a0c8f5a0687f5c7fef402b08cf337ebac
parentbba48b057cdc4f26721e06a5310652dcf0e55873
openocd: fix simple cases of Yoda condition

There are ~900 Yoda conditions to be aligned to the coding style.
For recurrent Yoda conditions it's preferable using a trivial
script in order to minimize the review effort.
E.g. comparison of uppercase macro/enum with lowercase variable:
- ...(ERROR_OK == retval)...
+ ...(retval == ERROR_OK)...

Patch generated automatically with the command:
sed -i \
's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \
$(find src/ -type f)

While there, remove the braces {} around a single statement block
to prevent warning from checkpatch.

Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6354
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
76 files changed:
src/flash/common.c
src/flash/nand/at91sam9.c
src/flash/nand/core.c
src/flash/nand/driver.c
src/flash/nand/fileio.c
src/flash/nand/lpc3180.c
src/flash/nand/lpc32xx.c
src/flash/nand/s3c24xx.h
src/flash/nand/tcl.c
src/flash/nor/ambiqmicro.c
src/flash/nor/atsamv.c
src/flash/nor/avrf.c
src/flash/nor/cc26xx.c
src/flash/nor/cc3220sf.c
src/flash/nor/efm32.c
src/flash/nor/em357.c
src/flash/nor/fm3.c
src/flash/nor/lpc2000.c
src/flash/nor/lpc2900.c
src/flash/nor/max32xxx.c
src/flash/nor/msp432.c
src/flash/nor/pic32mx.c
src/flash/nor/psoc4.c
src/flash/nor/sim3x.c
src/flash/nor/stellaris.c
src/flash/nor/stm32f1x.c
src/flash/nor/stm32f2x.c
src/flash/nor/stm32h7x.c
src/flash/nor/stm32l4x.c
src/flash/nor/stm32lx.c
src/flash/nor/stmqspi.c
src/flash/nor/str7x.c
src/flash/nor/str9x.c
src/flash/nor/str9xpec.c
src/flash/nor/swm050.c
src/flash/nor/tcl.c
src/flash/nor/xcf.c
src/hello.c
src/helper/command.c
src/helper/command.h
src/helper/fileio.c
src/jtag/adapter.c
src/jtag/aice/aice_transport.c
src/jtag/aice/aice_usb.c
src/jtag/core.c
src/jtag/drivers/parport.c
src/jtag/drivers/versaloon/versaloon.c
src/jtag/drivers/vsllink.c
src/jtag/drivers/xds110.c
src/jtag/hla/hla_tcl.c
src/jtag/tcl.c
src/openocd.c
src/pld/pld.c
src/rtos/rtos.c
src/server/gdb_server.c
src/server/server.c
src/svf/svf.c
src/target/arc.c
src/target/arc_mem.c
src/target/arm_cti.c
src/target/arm_dap.c
src/target/arm_tpiu_swo.c
src/target/armv8.c
src/target/cortex_a.c
src/target/etm.c
src/target/mips_m4k.c
src/target/mips_mips64.c
src/target/nds32.c
src/target/nds32_v2.c
src/target/nds32_v3.c
src/target/nds32_v3_common.c
src/target/nds32_v3m.c
src/target/openrisc/jsp_server.c
src/target/smp.c
src/target/target.c
src/target/x86_32_common.c