summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:43 -0700
committerGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:43 -0700
commit3bb091f52586bee88ed0d9380ce4df55d837fd5e (patch)
tree55d587dc3f0487e54274c92eedb1672aac073da8
parent93b3fb6196709a0de77059b6b2bb7b8e27530477 (diff)
downloadpetitboot-3bb091f52586bee88ed0d9380ce4df55d837fd5e.zip
petitboot-3bb091f52586bee88ed0d9380ce4df55d837fd5e.tar.gz
Simplify kexec
Simplify the pb_run_kexec() routine. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
-rw-r--r--ui/common/ui-system.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
index b252e9a..bd6dd31 100644
--- a/ui/common/ui-system.c
+++ b/ui/common/ui-system.c
@@ -92,34 +92,34 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
/**
* pb_run_kexec - Run kexec with the supplied boot options.
- *
- * For the convenience of the user, tries to load both files before
- * returning error.
*/
int pb_run_kexec(const struct pb_kexec_data *kd)
{
int result;
- char *l_image;
- char *l_initrd;
+ char *l_image = NULL;
+ char *l_initrd = NULL;
pb_log("%s: image: '%s'\n", __func__, kd->image);
pb_log("%s: initrd: '%s'\n", __func__, kd->initrd);
pb_log("%s: args: '%s'\n", __func__, kd->args);
- if (kd->image)
+ if (kd->image) {
l_image = pb_load_file(NULL, kd->image);
- else {
- l_image = NULL;
- pb_log("%s: error null image\n", __func__);
+ if (!l_image)
+ return -1;
+ }
+
+ if (kd->initrd) {
+ l_initrd = pb_load_file(NULL, kd->initrd);
+ if (!l_initrd)
+ return -1;
}
- l_initrd = kd->initrd ? pb_load_file(NULL, kd->initrd) : NULL;
+ if (!l_image && !l_initrd)
+ return -1;
- if (!l_image || (kd->initrd && !l_initrd))
- result = -1;
- else
- result = run_kexec_local(l_image, l_initrd, kd->args);
+ result = run_kexec_local(l_image, l_initrd, kd->args);
talloc_free(l_image);
talloc_free(l_initrd);
OpenPOWER on IntegriCloud