From patchwork Thu Nov 20 02:56:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 757 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607472; bh=dSIA/k4Y7W/nTCTCJ2IXMrtEn4IzdJSR+wOK9h3Kvmg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=PNvtHngZzS0gBEdT7wqZbYriwB96oRjlIjnbDZdIoULASYUQopGfcihzdqJcEW7AP MpHxPEgHJi60vMNp+nbfmKJNWo0kAXz6HaPyZQW47X+Al2UsLIJPMvQqGI4LDCqtcZ VEDLu3tgeZbOtRrdVRFyR37gspwheam12zijurcukiOfZ0UaN4lmZ4SU4G7CZ/UUrx T1USoi9DGv94+1+Eb7bqGnypvrinQhMQkx3h+QXom09edp65EmJPdhGiLzjF8smSSh DjcW6n4Zga/Q9N/P8aAGFS7EgL25K+pqLUSBdjwGes1ZEuQSOdjgpoZLc3sImuGRLc BYAQXxqcQg2Zw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A92C6686BB for ; Wed, 19 Nov 2025 19:57:52 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id P5inVadZOv7C for ; Wed, 19 Nov 2025 19:57:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607470; bh=dSIA/k4Y7W/nTCTCJ2IXMrtEn4IzdJSR+wOK9h3Kvmg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=OskJLe5rVYlK1qa8di8IBtGauehsA1PUVZiAsFidEcxTgk8+dppFmpTyDM9guSQhF HM+3flHC+IUrQl61KrvAg+mB1r4J1/u2Y6raKlNmv5weuRTvFU4hciqRqrN3TfTCZu fXvMcsAOJ6/ZF9GNWJrRtDbwgoDavmyWkWjGNUcfOR0/tC6kXwgprbnL/KKLQUZkVU YQrqYcbNh/LsutxHDr/PnVTRb2N6xEj3ayxjgQZHDoh/A+M8/0RAb2M1ZOr/mIR40e jlNZY+FbswW3OYm3It8b0ejrFoa5VdKtwhRYx2Xz7v7EmNOgUhxQ6IZzCH8p1cFBqY 2xTF6JeCNHU+Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A97DA68657 for ; Wed, 19 Nov 2025 19:57:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607467; bh=QumgkZaLs9OfJuwwt8bchxvRSjMnOndViomJyQPrGSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w2d81bnGEGqCEADQPaigk0aJwBtuO2O2xcLkKv6iT277o05gSMQ6fYbO371H1fUUG peiGHUkFNQS5nv4Ij+cx/HwTQcKiKSwH2vZ8en8KSXJsMoy4y7moakbWuF8NAy/daT ASQUJk5wuR9x6GzrYJo2pQusewmRWHzHyZ007SG2y+d4zHTICU2KabIAA1PV+KPLMn v9229u3t2Lml807AbEh79g89P6M4hxy8LNpa9GtjRF/cWGuOeO7SrelgD+NgHJSZPL EK9XHOlkjOnvozlLepjjguGCnIuXFjdxB/3TAfgJG55bATF0JoHlnLRWKr0YAYJXT3 sm1n1mvGqV9rQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6CF4E686BB; Wed, 19 Nov 2025 19:57:47 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 8byjM2CDtMjd; Wed, 19 Nov 2025 19:57:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763607461; bh=Vn4XhpSSBToXuc7cbtTYO57MnRP2hUUfwL4GLaDI6ME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHIXkkMgFM+Ujmvk121Lf8vY8kmdQ1nzYtj92dH9V7xKgHUrBnz1M+9hKpbQmi47T 8NVDCjI9vQ4vunAIoTnJ6yHEWLgHePRraXkngTwLm6QeJo1pXt/Cy3EFJv1B4FUe20 94gfqMzaMIUGEhnmrvfbIiCu/64dFCw7WK87YIo8B4n/urv4WpEZGo7nDeawCuB0E3 o66PU84t2REK9Uy3zl61i7NzZ+4kLIf/9ljZwZxgXxReHJLe5lypJTVg0aaf/o2Iz9 hu+IoENVGtp/s01UHcpVGiOV3taqKfSPhhlSpis5gf3vVeqKijcxr14uzrfVa/yVUH 47DUxmgkbBuxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 67EC368631; Wed, 19 Nov 2025 19:57:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 19 Nov 2025 19:56:03 -0700 Message-ID: <20251120025614.2215587-29-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120025614.2215587-1-sjg@u-boot.org> References: <20251120025614.2215587-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: PRLXAKNCMVPCUXOF7ZKT4TOYP2TM6UHY X-Message-ID-Hash: PRLXAKNCMVPCUXOF7ZKT4TOYP2TM6UHY X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 28/30] fit: Use a boolean to simplify type checks List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a boolean variable 'loadable' that combines the common type check for kernel, standalone, and ramdisk images. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/fit_print.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/boot/fit_print.c b/boot/fit_print.c index 70199a34c18..6772460a151 100644 --- a/boot/fit_print.c +++ b/boot/fit_print.c @@ -340,29 +340,27 @@ void fit_image_print(struct fit_print_ctx *ctx, int image_noffset) genimg_print_size(size); /* Remaining, type dependent properties */ - if (type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || - type == IH_TYPE_RAMDISK || type == IH_TYPE_FIRMWARE || - type == IH_TYPE_FLATDT) { + bool loadable = type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || + type == IH_TYPE_RAMDISK; + + if (loadable || type == IH_TYPE_FIRMWARE || type == IH_TYPE_FLATDT) { fit_image_get_arch(fit, image_noffset, &arch); emit_label_val(ctx, "Architecture", genimg_get_arch_name(arch)); } - if (type == IH_TYPE_KERNEL || type == IH_TYPE_RAMDISK || - type == IH_TYPE_FIRMWARE) { + if (loadable || type == IH_TYPE_FIRMWARE) { fit_image_get_os(fit, image_noffset, &os); emit_label_val(ctx, "OS", genimg_get_os_name(os)); } - if (type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || - type == IH_TYPE_FIRMWARE || type == IH_TYPE_RAMDISK || - type == IH_TYPE_FPGA || type == IH_TYPE_FLATDT) { + if (loadable || type == IH_TYPE_FIRMWARE || type == IH_TYPE_FPGA || + type == IH_TYPE_FLATDT) { ret = fit_image_get_load(fit, image_noffset, &load); - if ((type != IH_TYPE_FLATDT) || !ret) + if (type != IH_TYPE_FLATDT || !ret) emit_addr(ctx, "Load Address", load, !ret); } - if (type == IH_TYPE_KERNEL || type == IH_TYPE_STANDALONE || - type == IH_TYPE_RAMDISK) { + if (loadable) { ret = fit_image_get_entry(fit, image_noffset, &entry); emit_addr(ctx, "Entry Point", entry, !ret); }