Commit 6271d370 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fexc: Fix thinko in script decompiler



Both the error output in function decompile_section() and the
definition of GPIO_BANK_MAX in script.h suffered from an "off
by one" logic. The bank numbering in the .bin is based on 1,
so it should be added to ('A' - 1) for human-readable output,
and the maximum number corresponding to 'N' is 14.

This became apparent when trying to translate a fex2bin-compiled
a80_optimus_board.bin back to its original .fex equivalent.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 0b7bcc4a
......@@ -19,7 +19,7 @@
#include "list.h"
#define GPIO_BANK_MAX 13 /* N */
#define GPIO_BANK_MAX 14 /* N, (zero-based) index 13 */
/** head of the data tree */
struct script {
......
......@@ -269,9 +269,12 @@ static int decompile_section(void *bin, size_t bin_size,
} else if (gpio->port == 0xffff) {
; /* port:power */
} else if (gpio->port < 1 || gpio->port > GPIO_BANK_MAX) {
pr_err("%s: %s.%s: unknown GPIO port bank %c (%u)\n",
filename, section->name, entry->name,
'A'+gpio->port, gpio->port);
pr_err("%s: %s.%s: unknown GPIO port bank ",
filename, section->name, entry->name);
char c = 'A' + gpio->port - 1;
if (c >= 'A' && c <= 'Z')
pr_err("%c ", c);
pr_err("(%u)\n", gpio->port);
goto failure;
}
v[0] = gpio->mul_sel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment