drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / vendorcode / google / chromeos / vpd_serialno.c
blob9a3aa81ceb08d8447c053cfe1df4a020cc90020d
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boot/coreboot_tables.h>
4 #include <console/console.h>
5 #include <assert.h>
6 #include <string.h>
8 #include <drivers/vpd/vpd.h>
10 void lb_table_add_serialno_from_vpd(struct lb_header *header)
12 struct lb_string *serialno_rec = NULL;
13 const char serialno_key[] = "serial_number";
14 char serialno[32];
15 size_t len;
17 if (!vpd_gets(serialno_key, serialno,
18 sizeof(serialno), VPD_RO_THEN_RW)) {
19 printk(BIOS_ERR, "no serial number in vpd\n");
20 return;
22 printk(BIOS_DEBUG, "serial number is %s\n", serialno);
23 len = strlen(serialno) + 1;
24 ASSERT(len <= 32);
26 serialno_rec = (struct lb_string *)lb_new_record(header);
27 serialno_rec->tag = LB_TAG_SERIALNO;
29 serialno_rec->size = ALIGN_UP(sizeof(*serialno_rec) + len, 8);
30 memcpy(&serialno_rec->string, serialno, len);