mirror of
https://github.com/linux-sunxi/sunxi-tools.git
synced 2024-11-23 01:46:44 +08:00
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: Bernhard Nortmann <bernhard.nortmann@web.de>
This commit is contained in:
parent
0b7bcc4aa2
commit
6271d370af
2
script.h
2
script.h
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user