forked from auracaster/openocd
openocd: manually fix Yoda conditions
Fix the remaining Yoda conditions, detected by checkpatch but not fixed automatically. While there, apply minor style changes. Change-Id: I6e1978b89c4d56a20aceaeb2b52968eb6384432a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6356 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
@@ -801,7 +801,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||
info = bank->driver_priv;
|
||||
|
||||
/* Convert the range to the page numbers */
|
||||
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
||||
if (sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr) != 1) {
|
||||
LOG_WARNING("Error parsing address");
|
||||
command_print(CMD, "max32xxx protection_set <bank> <addr> <size>");
|
||||
return ERROR_FAIL;
|
||||
@@ -809,7 +809,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||
/* Mask off the top portion on the address */
|
||||
addr = (addr & 0x0FFFFFFF);
|
||||
|
||||
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
||||
if (sscanf(CMD_ARGV[2], "0x%"SCNx32, &len) != 1) {
|
||||
LOG_WARNING("Error parsing length");
|
||||
command_print(CMD, "max32xxx protection_set <bank> <addr> <size>");
|
||||
return ERROR_FAIL;
|
||||
@@ -857,7 +857,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||
info = bank->driver_priv;
|
||||
|
||||
/* Convert the range to the page numbers */
|
||||
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
||||
if (sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr) != 1) {
|
||||
LOG_WARNING("Error parsing address");
|
||||
command_print(CMD, "max32xxx protection_clr <bank> <addr> <size>");
|
||||
return ERROR_FAIL;
|
||||
@@ -865,7 +865,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||
/* Mask off the top portion on the address */
|
||||
addr = (addr & 0x0FFFFFFF);
|
||||
|
||||
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
||||
if (sscanf(CMD_ARGV[2], "0x%"SCNx32, &len) != 1) {
|
||||
LOG_WARNING("Error parsing length");
|
||||
command_print(CMD, "max32xxx protection_clr <bank> <addr> <size>");
|
||||
return ERROR_FAIL;
|
||||
|
||||
Reference in New Issue
Block a user