coding style: remove useless break after a goto or return
In a switch/case statement, a break placed after a goto or return
is never executed.
The script checkpatch available in Linux kernel v5.1 issues a
warning for such unused break statements.
In the process of reviewing the new checkpatch for its inclusion
in OpenOCD, let's get rid of these warnings.
The script checkpatch is unable to fixup automatically this case.
Thanks to having "break" command using a single code line, this
patch has been generated using the script below:
find src/ -type f -exec ./tools/scripts/checkpatch.pl -q \
--types UNNECESSARY_BREAK -f {} \; \
| sed -n '/^#/{s/^.*FILE: //;s/:$//;s/:/ /;p}' \
| awk 'function P() {print "sed -i '\''"b"'\'' "a};
{
if ($1!=a) {
if (a) {P()};
a=$1;
b=$2"{d}";
} else {
b=b";"$2"{d}"
}
};
END {P()}'
Change-Id: I56ca098faa5fe8d1e3f712dc0a029a3f10559d99
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5617
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
This commit is contained in:
@@ -1223,7 +1223,6 @@ int arm_get_gdb_reg_list(struct target *target,
|
||||
(*reg_list)[25] = arm->cpsr;
|
||||
|
||||
return ERROR_OK;
|
||||
break;
|
||||
|
||||
case REG_CLASS_ALL:
|
||||
switch (arm->core_type) {
|
||||
@@ -1273,12 +1272,10 @@ int arm_get_gdb_reg_list(struct target *target,
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR("not a valid register class type in query.");
|
||||
return ERROR_FAIL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user