diff mbox series

[u-boot,v2019.04-aspeed-openbmc,5/5] cmd/otp: Reduce size of otpkey

Message ID 20220718084728.1140108-6-joel@jms.id.au
State New
Headers show
Series OTP Fixes | expand

Commit Message

Joel Stanley July 18, 2022, 8:47 a.m. UTC
Don't store more information than is used. Saves 3KB.

  Function                                     old     new   delta
  _otp_print_key                               540     580     +40
  otp_verify_boot_image                       1276    1268      -8
  a2_key_type                                  640      40    -600
  a1_key_type                                  640      40    -600
  a3_key_type                                 1024      64    -960
  a0_key_type                                 1024      64    -960
  Total: Before=266547, After=263459, chg -1.16%

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
This patch includes Zev's suggestion to make the bitfields unsigned:

 https://lore.kernel.org/openbmc/20220716090847.GC9659@packtop/

 cmd/otp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/cmd/otp.c b/cmd/otp.c
index add70c841405..2df410dfd024 100644
--- a/cmd/otp.c
+++ b/cmd/otp.c
@@ -133,11 +133,11 @@  struct otpstrap_status {
 };
 
 struct otpkey_type {
-	int value;
-	int key_type;
-	int order;
-	int need_id;
-	char information[110];
+	unsigned int value: 4;
+	unsigned int key_type: 4;
+	unsigned int order: 1;
+	unsigned int need_id: 1;
+	char *information;
 };
 
 struct otp_pro_sts {