From patchwork Wed Sep 25 14:57:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1167483 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bJfoFWAC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46dk0t1BH4z9sNx for ; Thu, 26 Sep 2019 02:24:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D06BEC221A5; Wed, 25 Sep 2019 16:12:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B7F64C2222D; Wed, 25 Sep 2019 15:05:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D605FC22228; Wed, 25 Sep 2019 15:05:07 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id 32AB5C220CB for ; Wed, 25 Sep 2019 14:59:08 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id q1so14664559ion.1 for ; Wed, 25 Sep 2019 07:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HOh8/LQbuPe4InGEL5rkYHmreFcPDZmrjk7bSnNamjM=; b=bJfoFWACu7DcUsqsUtnToZbwxLpKml3A5bqSrs/p33lpu8+D+kq7G8kOkOS7StAxEt R2kHgRM6S7ITqlaac5Eq/QM8pNLSVUIfZL1k1py1mXHxLxz3BOwNdKRmujTG3xnZG+b7 uVIrX1YDVrUosKJTXBZ4zld7RudJOrUafuL9A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HOh8/LQbuPe4InGEL5rkYHmreFcPDZmrjk7bSnNamjM=; b=k8xQWXuZCyX6CqUdgWVUfalrls2WGjZTzl+RD4R7SG6V0jVtGRc27k7+yd1TfuP9x0 hyZly791r3olWsuXOpm8gFPHuyhC0SRnkNz9NHEWc6Wh0hUuxtQ8Y4+Jdb/h1pyouRo2 r2w2rBBtsFf+ctEHBBf9sn7M9wulPUgxAreyQtLI0xq689eL6uy0rLm6ipNf6VMk3Iez T+WbbOQgpH4PCcgNe0MtzfMUXrcRbjVwUNkUHZPVjWC4zCZfkq65B+rsn+2ssygBnCux kJ+r6Cn2dtVZVLPwprg85aqXq4KUEZ5iS+aWGEed/18BvsoqtBna23s0j1KIH3QLE2hH 1LnA== X-Gm-Message-State: APjAAAU934iuH0HXIYrlAFwwSVNOBN8LZO52ZNCthWhpJPNQs5ks6i8U GSgdGfFVNlri/SC55ANfoY8RSAAtRe0= X-Google-Smtp-Source: APXvYqwwreXUYKdQi/vlV3d9QvWDFbea4vQKIA2W7PlgfLjXF3UGB3KpdCXnG7Sh27wB0VjMZdtv1g== X-Received: by 2002:a6b:b8c3:: with SMTP id i186mr2319757iof.194.1569423545566; Wed, 25 Sep 2019 07:59:05 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id d9sm4254964ioq.9.2019.09.25.07.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 07:59:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 25 Sep 2019 08:57:08 -0600 Message-Id: <20190925145750.200592-85-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-goog In-Reply-To: <20190925145750.200592-1-sjg@chromium.org> References: <20190925145750.200592-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 084/126] x86: Tidy up error handling in mrccache_save() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" This function is a bit confusing at present due to the error handling. Update it to remove the goto, returning errors as they happen. While we are here, use hex for the data size since this is the norm in U-Boot. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/lib/mrccache.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c index 9a3e5fffa45..0208696c834 100644 --- a/arch/x86/lib/mrccache.c +++ b/arch/x86/lib/mrccache.c @@ -248,28 +248,23 @@ int mrccache_save(void) if (!gd->arch.mrc_output_len) return 0; - debug("Saving %d bytes of MRC output data to SPI flash\n", + debug("Saving %#x bytes of MRC output data to SPI flash\n", gd->arch.mrc_output_len); ret = mrccache_get_region(&sf, &entry); if (ret) - goto err_entry; + return log_msg_ret("Cannot get region", ret); ret = device_probe(sf); if (ret) - goto err_entry; + return log_msg_ret("Cannot probe device", ret); cache = gd->arch.mrc_cache; ret = mrccache_update(sf, &entry, cache); - if (!ret) { + if (!ret) debug("Saved MRC data with checksum %04x\n", cache->checksum); - } else if (ret == -EEXIST) { + else if (ret == -EEXIST) debug("MRC data is the same as last time, skipping save\n"); - ret = 0; - } -err_entry: - if (ret) - debug("%s: Failed: %d\n", __func__, ret); - return ret; + return 0; } int mrccache_spl_save(void)