Commit 151f7afe authored by Alejandro Mery's avatar Alejandro Mery
Browse files

bin2fex: improved error handling

parent 3abad84f
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
/** /**
*/ */
static int decompile_gpio(struct script_section *section, struct script_section_entry *entry, struct script_gpio_value *gpio, int length, FILE *out) static inline int decompile_gpio(struct script_section *section,
struct script_section_entry *entry,
struct script_gpio_value *gpio,
int length, FILE *out)
{ {
int ok = 1; int ok = 1;
char port = '?'; char port = '?';
...@@ -85,9 +88,11 @@ static int decompile_section(void *bin, size_t bin_size, ...@@ -85,9 +88,11 @@ static int decompile_section(void *bin, size_t bin_size,
switch(type) { switch(type) {
case SCRIPT_VALUE_TYPE_SINGLE_WORD: { case SCRIPT_VALUE_TYPE_SINGLE_WORD: {
int32_t *d = data; int32_t *d = data;
if (length != 1) if (length != 1) {
pr_err("%s.%s: invalid length %d (assuming %d)\n", pr_err("%s.%s: invalid length %d (assuming %d)\n",
section->name, entry->name, length, 1); section->name, entry->name, length, 1);
ok = 0;
}
/* TODO: some are preferred in hexa */ /* TODO: some are preferred in hexa */
fprintf(out, "%s\t= %d\n", entry->name, *d); fprintf(out, "%s\t= %d\n", entry->name, *d);
...@@ -113,6 +118,7 @@ static int decompile_section(void *bin, size_t bin_size, ...@@ -113,6 +118,7 @@ static int decompile_section(void *bin, size_t bin_size,
pr_err("%s.%s: unknown type %d\n", pr_err("%s.%s: unknown type %d\n",
section->name, entry->name, type); section->name, entry->name, type);
fprintf(out, "%s\t=\n", entry->name); fprintf(out, "%s\t=\n", entry->name);
ok = 0;
break; break;
} }
} }
......
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