From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 636CFC433F5 for ; Sun, 26 Sep 2021 01:48:11 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D529B61090 for ; Sun, 26 Sep 2021 01:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D529B61090 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 56B01835C5; Sun, 26 Sep 2021 03:47:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LQXjcfBr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AFCF1835FF; Sun, 26 Sep 2021 03:45:16 +0200 (CEST) Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9D793835DF for ; Sun, 26 Sep 2021 03:44:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x336.google.com with SMTP id j11-20020a9d190b000000b00546fac94456so18938654ota.6 for ; Sat, 25 Sep 2021 18:44:14 -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=iCRglFvzN0/mE6K/dDSmwkYK5CkP6P0AtWsXDHsmqns=; b=LQXjcfBrWSkJl1wZ3LQtQmHRbSl04Fhty+4XlCslKF7R25Gg7tSJ2pvvUdpYKAHjhK i+5l1wFxGkeXrEv0ypiGPg5qfikUbstkxpKOnxu5qegRMa/2I7C5c56XbQ8nX5i5oZCN RM0toupzpPe1oVoKLjneEYw9GcqGD4TqK1GHQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iCRglFvzN0/mE6K/dDSmwkYK5CkP6P0AtWsXDHsmqns=; b=YOJNiGLw9vE6YgKUwaUyWjP7mqVrWVadkxUp235outCg5wMiClGSvpu8G2a4eh8hVr qXZ2DJQpHR11nEpL6i9kJN32k74jhBGskrxsNTAk4cQ8Uc+qxZynZyJJS8MRmNt5uTy8 IN5nGHLnczdp5YUXo+YzH0uOK3ItcEKHpTEqCh1M8dJ3dScYTuIvvkcTaYTg+VVq2hKJ Un/IeSp3rKIkNw6LBOCcIXCrWusLq1QWgjdY1obUbFyi/k25jaf+Ebbda2dya4vY2XFD wABNL+umFbV+ynxyOrSmlfP9nRsQWWCfkwiKwc2PfTx5uswRKZf3eAQbFXIOx124EQEk KL9w== X-Gm-Message-State: AOAM533z+212Y9Z04DDlsTEOcS/w8Jb8K25Y4XEsXsVbYB5y4UFeHBPb pFrXXHKpoLhipNkyGzsV2qNeOS0DEfnGHw== X-Google-Smtp-Source: ABdhPJxiJQsVII2u8hRxUF2WCQ7jDKtHBg0ow3t8AmzGdVsFwtqP27EEvXW1niQPH6qI+94/aAn2hw== X-Received: by 2002:a05:6830:114e:: with SMTP id x14mr199322otq.222.1632620653073; Sat, 25 Sep 2021 18:44:13 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c18sm330378otr.72.2021.09.25.18.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 18:44:12 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alexandru Gagniuc , Andre Przywara , Rasmus Villemoes , Robert Marko , Masahiro Yamada , Tom Rini , Simon Glass , Joe Hershberger , Marek Vasut Subject: [PATCH v5 23/29] image: Reduce variable scope in boot_get_ramdisk() Date: Sat, 25 Sep 2021 19:43:36 -0600 Message-Id: <20210926014342.127913-17-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog In-Reply-To: <20210926014342.127913-1-sjg@chromium.org> References: <20210926014342.127913-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.103.2 at phobos.denx.de X-Virus-Status: Clean Move the variables declarations to where they are needed, to reduce the number of #ifdefs needed. Signed-off-by: Simon Glass --- (no changes since v1) common/image-board.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/image-board.c b/common/image-board.c index cbc8a55ba9f..0c9500829a1 100644 --- a/common/image-board.c +++ b/common/image-board.c @@ -337,18 +337,8 @@ int genimg_has_config(bootm_headers_t *images) int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images, u8 arch, ulong *rd_start, ulong *rd_end) { - ulong rd_addr, rd_load; ulong rd_data, rd_len; -#if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) - const image_header_t *rd_hdr; -#endif void *buf; -#if CONFIG_IS_ENABLED(FIT) - const char *fit_uname_config = images->fit_uname_cfg; - const char *fit_uname_ramdisk = NULL; - ulong default_addr; - int rd_noffset; -#endif const char *select = NULL; *rd_start = 0; @@ -373,8 +363,15 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images, rd_len = 0; rd_data = 0; } else if (select || genimg_has_config(images)) { + ulong rd_addr, rd_load; + #if CONFIG_IS_ENABLED(FIT) + const char *fit_uname_config = images->fit_uname_cfg; + const char *fit_uname_ramdisk = NULL; + int rd_noffset; + if (select) { + ulong default_addr; /* * If the init ramdisk comes from the FIT image and * the FIT image address is omitted in the command @@ -427,7 +424,9 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images, buf = map_sysmem(rd_addr, 0); switch (genimg_get_format(buf)) { #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT) - case IMAGE_FORMAT_LEGACY: + case IMAGE_FORMAT_LEGACY: { + const image_header_t *rd_hdr; + printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n", rd_addr); @@ -442,6 +441,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images, rd_len = image_get_data_size(rd_hdr); rd_load = image_get_load(rd_hdr); break; + } #endif #if CONFIG_IS_ENABLED(FIT) case IMAGE_FORMAT_FIT: -- 2.33.0.685.g46640cef36-goog