From patchwork Wed May 27 11:56:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1298824 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2014 header.b=LRqeYk5L; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49X8Sz0rrZz9sSk for ; Wed, 27 May 2020 21:57:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 49072819A6; Wed, 27 May 2020 13:56:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=libero.it header.i=@libero.it header.b="LRqeYk5L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF3878179F; Wed, 27 May 2020 13:56:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FROM,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from libero.it (smtp-16.italiaonline.it [213.209.10.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 10A108179F for ; Wed, 27 May 2020 13:56:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=libero.it Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dariobin@libero.it Received: from localhost.localdomain ([185.33.57.41]) by smtp-16.iol.local with ESMTPA id dufZjM63oj8kvdufsjWCYd; Wed, 27 May 2020 13:56:44 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014; t=1590580604; bh=WOyPXuWk5X/TdP36mWQIlxDFfLcsUhX3Fkln1RqVrKw=; h=From; b=LRqeYk5LZXbzetZLZ56bIP4C0nnj+WN12UkHsKf5vvj4f5SX6C5cvQXWsKms81NmG qVnaVO6zp3owFlMlsRWhvDxSIdyC3Z1UFDMCufd+Dd6Lan7wX3BRhk1WX4wTFUFEcD lFEScbLqdb3lZKGsVgBYiX8JSCfODkyvT1EKjKy+n3Y2tl/1VIDjUhgxF0RYBOy6oS 38PyU65xNPVJjpDy5ek7Y7PRqNSF1jOhmxANC0QVeRIIvz1h14Jd7VARTwneDs5POR 7kDsjqLg6ZwFFsTxzYh9EV2Q5KCqSoxu8RmHVM4GDvMrks3V4kQA2537Dqk2nmNFIo dpLc+yhLkwHQA== X-CNFS-Analysis: v=2.3 cv=V9gDLtvi c=1 sm=1 tr=0 a=7k5bMzoTbf4q2w+SfadHRQ==:117 a=7k5bMzoTbf4q2w+SfadHRQ==:17 a=iP-xVBlJAAAA:8 a=3AI37ckIDkq0_7urXOkA:9 a=lHLH-nfn2y1bM_0xSXwp:22 From: Dario Binacchi To: u-boot@lists.denx.de Cc: Michael Trimarchi , Dario Binacchi , Andreas Dannenberg , Anup Patel , Jean-Jacques Hiblot , "Klaus H. Sorensen" , Lukas Auer , Michal Simek , Simon Glass , Simon Goldschmidt , Stefano Babic , Ye Li Subject: [PATCH v3 2/4] spl: fit: fail fit loading in case of FDT appending error Date: Wed, 27 May 2020 13:56:19 +0200 Message-Id: <20200527115621.1062-3-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200527115621.1062-1-dariobin@libero.it> References: <20200527115621.1062-1-dariobin@libero.it> X-CMAE-Envelope: MS4wfAT6W0OuoiXFPhEG0+/WohGlmtltXQzji21znFgLpISUOAIFn0H8Y9XWLFcfblA6fQHVciOMVWGdWfP/j7q9Fot4X+nZnRHSUQYrCbI31zxVClhWuB/G fs7RPKY+AgOPoGYYL07bJ+z1yI3u8Xo62+0Np5hh1eLfCqCUrcPIhcjjA+EFYU4XISi8fUgQTuMH6uwxiLKwVQZs1I4qHk8tv4Qi9uvRV+AUxQvhKovaJWHR lfMyaHM5fihzer12VGOLAUhRe3sqfVc4SXHPSodlFDec66fms6pYSyTMU0+PrWHQXk6GALANVehSn+JjAcoUPAVpoVELRz/IXF9bRZN68b9Dx0de5Am1b0FH fXf8Tb0n4EpjTJsqE1slMxFSF90xagh3o9o+tvtgwyp5d3a30PGj3S5TbaCMpy6ryO+TpNLDDl/ynzAIzDn2hFJOP8V3FqM3z76x/BxWyupmyWX0ajCAyWL+ fJd6dt7uSQ5Lin8c3xftzbjCC/C8sGnKve9LFwVKpy8yfDL+weNUIw6utOupFLlherwPs2vOxs+fSFlVe/voiWBj2hJOO08ZcnhsIw== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean If uboot does not embed its device tree and the FIT loading function returns error in case of failure in the FDT append, the redundant itb image could be loaded. cc: Michael Trimarchi Signed-off-by: Dario Binacchi Reviewed-by: Michael Trimarchi Reviewed-by: Simon Glass --- Changes in v3: None Changes in v2: - Replace CONFIG_IS_ENABLED(OF_EMBED) with IS_ENABLED(CONFIG_OF_EMBED)) common/spl/spl_fit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index f581a22421..365104fe02 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -619,9 +619,12 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, * Booting a next-stage U-Boot may require us to append the FDT. * We allow this to fail, as the U-Boot image might embed its FDT. */ - if (spl_image->os == IH_OS_U_BOOT) - spl_fit_append_fdt(spl_image, info, sector, fit, - images, base_offset); + if (spl_image->os == IH_OS_U_BOOT) { + ret = spl_fit_append_fdt(spl_image, info, sector, fit, + images, base_offset); + if (!IS_ENABLED(CONFIG_OF_EMBED) && ret < 0) + return ret; + } firmware_node = node; /* Now check if there are more images for us to load */