dtc: Simplify error handling for unparseable input

Currently, main() tests if it got a valid input tree from whichever
dt_from_*() function it invoked and if not, die()s.  For one thing,
this test has, for no good reason, three different ways for those
functions to communicate a failure to provide input (bi NULL, bi->dt
NULL, or bi->error non-zero).  For another, in every case save one, if
the dt_from_*() functions are unable to provide input they will
immediately die() (with a more specific error message) rather than
proceeding to the test in main().

Therefore, this patch removes this test, making the one case that
could have triggered it (in dt_from_source()) call die() directly
instead.  With this change, the error field in struct boot_info is now
unused, so remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2008-05-16 13:21:51 +10:00 committed by Jon Loeliger
parent 1577696b6d
commit 35aa1a273b
4 changed files with 4 additions and 7 deletions

View file

@ -36,9 +36,11 @@ struct boot_info *dt_from_source(const char *fname)
yyin = srcpos_file->file;
if (yyparse() != 0)
return NULL;
die("Unable to parse input tree\n");
if (treesource_error)
die("Syntax error parsing input tree\n");
the_boot_info->error = treesource_error;
return the_boot_info;
}