From patchwork Tue Jul 4 13:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1803208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=mMbt6CQk; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=e4RtsJxt; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=CJQCa+9B; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QwNWT0myYz20b5 for ; Tue, 4 Jul 2023 23:12:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oTT8xvLk1fWSBZuK5gZOrt5iKhElUOUmO/7pwEL38O4=; b=mMbt6CQkAd46h2 jGz2PpoG3JX3+1gLXNSey0WS/5wP6VUMT7YB6eNWxMfH4DMdyVNLqpu5obhvGGz1DCDnXg6BY+dte adVcUW5cANio2tPJf0vXzpEOrWcEbLPXHZv2EA/EfrRFxj5WoM9chgpUVFxVMsH30lsR7xU+tjsD6 FENb+Z6hjLk7NmBQsXvUnXeNtR++q5Oihq19UhghgE7963f9QNnDXwO8lKpyBWY6X+GGijcYLFSQ6 Wc3FN+P9I+EFuIKGNaSv0lkJB7xW9YC/1BrvqXILIXzS56yW+sOFUu/1+NF05Vz72HN9GzcjtmIG4 o5a8Vv9ssejPONl358vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGfpe-00DLQq-2d; Tue, 04 Jul 2023 13:12:38 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGfpd-00DLQ3-0i for opensbi@bombadil.infradead.org; Tue, 04 Jul 2023 13:12:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=CRYGc/h9Okky6e89Z0r4MeC0c4LY3dZGQjzwt+vtg/I=; b=e4RtsJxtp6Ip1E8NiEzdoheua4 OO1Sz4VcmZKhX6z3TCN7VX/mB/DzlSjKnSXFTuqfiJRa4qovaNc8HAze3J5z3lP5xbRd+KCZHoW3W NiSl0+x/768Tpju8RqozqM9R/+MHcVMDz0AQL2ryFs5oZ3ahmZ5rHA4WtQXPeBbs3x1WMDb6ZwB4K mmrAr3X22xodiSEEn0TLN6pYtbRc2/vKUGO1sUgYYSqPVZlDsgX0zE2C1iUUpCZZc6SEoq5gXJp8S BjSRG/elIukGWqrzwLPOE7I1FK7iHbB5Tsc7gk/cAnmaKfS7YxbDETxgZK0c+5qM7OG3utO1lrlRW UB/G4AUg==; Received: from m126.mail.126.com ([220.181.12.26]) by desiato.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGfpY-00AvJ8-11 for opensbi@lists.infradead.org; Tue, 04 Jul 2023 13:12:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=CRYGc /h9Okky6e89Z0r4MeC0c4LY3dZGQjzwt+vtg/I=; b=CJQCa+9BrxNIOrLVoY2Jv j0yFcgvsV44ZXyYW9ARUki5AmGJu4eBazRx1CD1v2htHC7wW+Q9VKrIRFuoL/EcH zap1NJxXWeBQw0LAiiA493oylhfRyFllx1g2YVlOu9EWIcaT26Ecb2SrnJLOsdx2 sAxl8lsu+3Eg0413z533ew= Received: from x390.lan (unknown [58.247.180.222]) by zwqz-smtp-mta-g1-0 (Coremail) with SMTP id _____wCXJ8CyGqRkGritAQ--.14207S4; Tue, 04 Jul 2023 21:12:20 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org, jrtc27@jrtc27.com Subject: [PATCH v7 02/11] lib: sbi: print not fill '0' when left-aligned Date: Tue, 4 Jul 2023 21:11:59 +0800 Message-Id: <20230704131208.465914-3-wxjstz@126.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230704131208.465914-1-wxjstz@126.com> References: <20230704131208.465914-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wCXJ8CyGqRkGritAQ--.14207S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7XF1DGFyUtrW7Kr1fCrWfKrg_yoWxZrbEy3 yxA340grZ8JFZavr1ktF48Wr4Fkw18ursrWF17KFs0yrWIvr4UX3y0qr9Fgas8Ar47uryI k3y7Arn0kry5WjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRWUDXUUUUUU== X-Originating-IP: [58.247.180.222] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbi1xSiOl53bj3WoAAAsX X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230704_141233_079479_9824811C X-CRM114-Status: UNSURE ( 6.92 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Left alignment and padding '0' should not exist at the same time, this patch skips padding. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- lib/sbi/sbi_console.c | 2 ++ 1 file changed, 2 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz[at]126.com] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Left alignment and padding '0' should not exist at the same time, this patch skips padding. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- lib/sbi/sbi_console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c index d87b5c2..03ee05a 100644 --- a/lib/sbi/sbi_console.c +++ b/lib/sbi/sbi_console.c @@ -288,6 +288,8 @@ static int print(char **out, u32 *out_len, const char *format, va_list args) if (!flags_done) ++format; } + if (flags & PAD_RIGHT) + flags &= ~PAD_ZERO; /* Get width */ for (; *format >= '0' && *format <= '9'; ++format) { width *= 10;