From patchwork Fri Oct 3 16:55:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 489 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=1759510587; bh=X1Vx7misU03e1Hfa0G73CmM49kJdS+ituPdz9dJk75I=; 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=FljbNOxtCjUxaXThVU0b2day43g6bSibBa3+C9W4UnFhGmoBR9oOjDzwXzSWi+SSM qHVEMN3hZw6BGYJTXqHWwPwbC5BadOWnmv6UysLMVtlKBja8G2xn+u/hT5q26kYkI/ O7mC44yN4qtZsiOdbhoQ0ZERKo5AqPD2kguH+/gYLiLt2HcH/8sRkqmoHGQWJzyl1W uvXXw+OBnCcwa+4t+WHQo1ULcC5eT8cNZMFEY7NMk8DBjx2+ZRfS9tDWNzFfawiiEL SGeLXdCd3G4vFQYaGCPZQebwpa24Swgom1UBPAFHpSjNJ2WZHYLeCRh8Nv5pIJLz8H ENMPSMqpAv9hw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3951D67EC5 for ; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) 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 Naq-zlrdx1wX for ; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510587; bh=X1Vx7misU03e1Hfa0G73CmM49kJdS+ituPdz9dJk75I=; 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=FljbNOxtCjUxaXThVU0b2day43g6bSibBa3+C9W4UnFhGmoBR9oOjDzwXzSWi+SSM qHVEMN3hZw6BGYJTXqHWwPwbC5BadOWnmv6UysLMVtlKBja8G2xn+u/hT5q26kYkI/ O7mC44yN4qtZsiOdbhoQ0ZERKo5AqPD2kguH+/gYLiLt2HcH/8sRkqmoHGQWJzyl1W uvXXw+OBnCcwa+4t+WHQo1ULcC5eT8cNZMFEY7NMk8DBjx2+ZRfS9tDWNzFfawiiEL SGeLXdCd3G4vFQYaGCPZQebwpa24Swgom1UBPAFHpSjNJ2WZHYLeCRh8Nv5pIJLz8H ENMPSMqpAv9hw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2323067E85 for ; Fri, 3 Oct 2025 10:56:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510584; bh=Ep6M+OJ9zcgVutrKS/LfLoK/H4HYKoy3tSUPkrinFNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4dp1CqAPtusPSky3qmuGx7leiikf3vNMfE2ttDH3wHjU/B70uHV5Ozz3DlNkCIo/ nV62k8nhFNdj5Nx13vRXK04x0eqmof5xagrkgeedV6nPcdDpqt4f7yKxtqxWDizjM7 uQqV33u7bPBxi8lrry2e7J+DqHajNqg2JehGmDTOJ8IOtoGrmcogcjKf9hEuIZkKoO yjdVgDYm/bc2wtHC4x0Q+Kfa/2tH+yUqAuVsN7hXme9sjW4qKFAnAf2UuaL7QaqFp0 BHNAdts5MjtXzMRzv7zrvusxeVRlLk2UmSbCzTmgjzMcjwKznjaz2meZru5XeDmylx q3TsdkWoApMgw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E754C67E7C; Fri, 3 Oct 2025 10:56:24 -0600 (MDT) 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 DAqnkSxeOyGV; Fri, 3 Oct 2025 10:56:24 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759510577; bh=1MfsyGk1rfHCdR9XeKODt145cRS5OXbdVqqH63iq1cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTGROvrhx5q1/kogIkFtR3tkCrWGA4zv88ugYYrzHbDU1yPev83t4tQo5aAxsyJGN OcA1Vuvy8hvhBhFYa3r0DnP09G8KuJGdqrex67xZ+rcbrllckNxzWlP4hIUaEUqHng 5zqheIH2Fgo3iLtij1dgJEEiCBfTAXub9d5hyWGTrIrHI0GITQZhgoFJPT6YAv0pBN krKgcHm4AlGhTfynRlxgH6uPHN7RX+0rLFtfkKjVaJUffyJXoirOLHmQgJcESPtQxU 8fsW27zldlBmxbW6d3mZpEedDaZFwkdNlBz4uM8tW/kSIhiL8fOg06lN7DZW+HndrT wPjHjfuEtUMdw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8170C67E85; Fri, 3 Oct 2025 10:56:17 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 3 Oct 2025 10:55:01 -0600 Message-ID: <20251003165525.440173-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003165525.440173-1-sjg@u-boot.org> References: <20251003165525.440173-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OSTUPOJI54MHWAV6J2GSZVFSCFDAJZWA X-Message-ID-Hash: OSTUPOJI54MHWAV6J2GSZVFSCFDAJZWA 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/22] video: Move setting of cte in write_pix8() to the top 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 The compiler can deal with the complexity of deciding whether to set up this local. Move it to the top of the function. Signed-off-by: Simon Glass --- drivers/video/video_bmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 478b8fbe5fd..390996dbaf1 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -68,14 +68,14 @@ static u32 get_bmp_col_rgba8888(struct bmp_color_table_entry *cte) static void write_pix8(u8 *fb, uint bpix, enum video_format eformat, struct bmp_color_table_entry *palette, u8 *bmap) { + struct bmp_color_table_entry *cte = &palette[*bmap]; + if (bpix == 8) { *fb++ = *bmap; } else if (bpix == 16) { - *(u16 *)fb = get_bmp_col_16bpp(palette[*bmap]); + *(u16 *)fb = get_bmp_col_16bpp(*cte); } else { /* Only support big endian */ - struct bmp_color_table_entry *cte = &palette[*bmap]; - if (bpix == 24) { *fb++ = cte->red; *fb++ = cte->green;