[PATCH] mmc: fix calculation of Max Enhanced Area

Schoyswohl, Roland Roland.Schoyswohl at ife-doors.com
Thu Mar 23 06:42:46 PDT 2023

According extcsd documentation, the HC_ERASE_GRP_SIZE must be multiplied by
HC_ERASE_GRP_SIZE and not added.

Signed-off-by: Roland Schoyswohl roland.schoyswohl at ife-doors.com
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 7ae068348d..f67c48404a 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -1427,7 +1427,7 @@ static int print_field(u8 *reg, int index)

            case EXT_CSD_MAX_ENH_SIZE_MULT:
                       tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
-                      tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
+                      tmp = tmp * get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
                       tmp64 *= tmp;
                       tmp64 *= SZ_512K;
                       printf("\tMax Enhanced Area: %llu B\n", tmp64);

Knorr-Bremse GmbH
FN 38565p, LG Wr. Neustadt

This transmission is intended solely for the addressee and contains confidential information.
If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system.
Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like.

More information about the barebox mailing list