From patchwork Thu Mar 16 04:19:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 739534 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vkFcx4g1yz9rxw for ; Thu, 16 Mar 2017 15:20:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="npU4sNjC"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vkFcx3bLvzDqZD for ; Thu, 16 Mar 2017 15:20:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="npU4sNjC"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mendozajonas.com (mendozajonas.com [188.166.185.233]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vkFcg3FLjzDqYt for ; Thu, 16 Mar 2017 15:20:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="npU4sNjC"; dkim-atps=neutral Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: sam@mendozajonas.com) by mendozajonas.com (Postfix) with ESMTPSA id 7C59D143F68; Thu, 16 Mar 2017 12:19:58 +0800 (SGT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com; s=mail; t=1489637999; bh=27XvflZ+DrXMwYiv0II6pstlOZw/tFjy4VQvYRTRflw=; h=From:To:Cc:Subject:Date:From; b=npU4sNjCC5sBHH2k+uU9TFqVHKHzWgY1rp8iEAWGRBqmZURUeNJy+qi9EwzEwVuVP FyKfngHjHV5fasIahAFmPWaU/yC40szDyS7KGuVaQitau4VHRLYUogcbkwMAoFrYtw WLrlPFzIdK9HqwxZODHETrRENUunNHvG+OlYbH1I= From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [PATCH 1/2] utils/hooks: Don't fail early if fb0 missing Date: Thu, 16 Mar 2017 15:19:51 +1100 Message-Id: <20170316041952.26883-1-sam@mendozajonas.com> X-Mailer: git-send-email 2.12.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 30-dtb-updates would exit early if the 'fb0' file was missing, however the set_stdout() step does not depend on this. Signed-off-by: Samuel Mendoza-Jonas --- utils/hooks/30-dtb-updates.c | 47 +++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/utils/hooks/30-dtb-updates.c b/utils/hooks/30-dtb-updates.c index aff3844..66e7a77 100644 --- a/utils/hooks/30-dtb-updates.c +++ b/utils/hooks/30-dtb-updates.c @@ -576,20 +576,10 @@ static int write_devicetree(struct offb_ctx *ctx) return rc; } - -int main(void) +static int set_offb(struct offb_ctx *ctx) { - struct offb_ctx *ctx; int rc; - ctx = talloc_zero(NULL, struct offb_ctx); - - ctx->dtb_name = getenv("boot_dtb"); - if (!ctx->dtb_name) { - talloc_free(ctx); - return EXIT_SUCCESS; - } - rc = load_dtb(ctx); if (rc) goto out; @@ -605,14 +595,39 @@ int main(void) rc = populate_devicetree(ctx); if (rc) goto out; +out: + return rc; +} - rc = set_stdout(ctx); - if (rc) - goto out; - rc = write_devicetree(ctx); +int main(void) +{ + struct offb_ctx *ctx; + int rc; + + ctx = talloc_zero(NULL, struct offb_ctx); + + ctx->dtb_name = getenv("boot_dtb"); + if (!ctx->dtb_name) { + talloc_free(ctx); + return EXIT_SUCCESS; + } + + if (set_offb(ctx)) { + warn("Failed offb setup step"); + rc = -1; + } + + if (set_stdout(ctx)) { + warn("Failed stdout setup step\n"); + rc = -1; + } + + if (write_devicetree(ctx)) { + warn("Failed to write back device tree\n"); + rc = -1; + } -out: talloc_free(ctx); return rc ? EXIT_FAILURE : EXIT_SUCCESS; }