From patchwork Wed Jul 8 00:11:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 29550 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 6D585B708C for ; Wed, 8 Jul 2009 10:19:40 +1000 (EST) Received: by ozlabs.org (Postfix) id B5883DE33C; Wed, 8 Jul 2009 10:19:09 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id B3FB4DE33B for ; Wed, 8 Jul 2009 10:19:09 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 89126DDF95; Wed, 8 Jul 2009 10:18:11 +1000 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX1/Wen7kqLM+SKKrg0hAmyy79FC7brBXuCw@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n680I4hF026421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jul 2009 00:18:04 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n680I444026418; Wed, 8 Jul 2009 00:18:04 GMT Message-Id: <20090708001135.483781401@am.sony.com> User-Agent: quilt/0.47-1 Date: Tue, 07 Jul 2009 17:11:42 -0700 From: Geoff Levand To: Jeremy Kerr In-Reply-To: <20090708001134.934244536@am.sony.com> References: <20090708001134.934244536@am.sony.com> Content-Disposition: inline; filename=simplify-kexec.diff X-Virus-Scanned: ClamAV 0.93.3/9541/Tue Jul 7 17:31:53 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Wed, 08 Jul 2009 00:18:05 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 08/31] petitboot: Simplify kexec X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Simplify the pb_run_kexec() routine. Signed-off-by: Geoff Levand --- ui/common/ui-system.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) --- a/ui/common/ui-system.c +++ b/ui/common/ui-system.c @@ -92,34 +92,34 @@ static int run_kexec_local(const char *l /** * 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; } - l_initrd = kd->initrd ? pb_load_file(NULL, kd->initrd) : NULL; + if (kd->initrd) { + l_initrd = pb_load_file(NULL, kd->initrd); + if (!l_initrd) + return -1; + } + + 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);