mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH] commands: mmc_extcsd: fix calculation of RPMB size
Date: Tue, 29 Jul 2025 15:59:24 +0200	[thread overview]
Message-ID: <20250729135924.122052-1-m.tretter@pengutronix.de> (raw)

EXT_CSD_RPMB_SIZE_MULT contains the number of 128 KB blocks in the RPMB.
While the calculated RMPB is labeled as KB, it actually contains the
size in bytes.

Fix the calculation to report the RPMB size in KB.

An alternative would have been to change the label to bytes, but since
the RPMB size is at least in an order of magnitude of KB, changing the
label is not intuitive.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 commands/mmc_extcsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index 7fa6235a4da9..e7b0fd82ee29 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -1544,7 +1544,7 @@ static int print_field(u8 *reg, int index)
 
 	case EXT_CSD_RPMB_SIZE_MULT:
 		val = get_field_val(EXT_CSD_RPMB_SIZE_MULT, 0, 0xFF);
-		val = val * 131072;
+		val = val * 128;
 		printf("\t[7-0] RPMB Partition Size: %u KB\n", val);
 		return 1;
 
-- 
2.39.5




             reply	other threads:[~2025-07-29 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 13:59 Michael Tretter [this message]
2025-07-29 14:53 ` Marco Felsch
2025-08-05  7:41 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250729135924.122052-1-m.tretter@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox