Formatting .c/.h files and fix memory leakage issues
Signed-off-by: John Chung <john.chung@arm.com>
Change-Id: Id8328f412c2724992d80c0b3f895c8f85bc4ae68
diff --git a/generator/sections/gen-section-cxl-component.c b/generator/sections/gen-section-cxl-component.c
index 5fb6789..b13a1f5 100644
--- a/generator/sections/gen-section-cxl-component.c
+++ b/generator/sections/gen-section-cxl-component.c
@@ -11,28 +11,29 @@
//Generates a single pseudo-random CXL component error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_cxl_component(void** location)
+size_t generate_section_cxl_component(void **location)
{
- //Create a random length for the CXL component event log.
- //The logs attached here do not necessarily conform to the specification, and are simply random.
- int log_len = rand() % 64;
+ //Create a random length for the CXL component event log.
+ //The logs attached here do not necessarily conform to the specification, and are simply random.
+ int log_len = rand() % 64;
- //Create random bytes.
- int size = 32 + log_len;
- UINT8* bytes = generate_random_bytes(size);
+ //Create random bytes.
+ int size = 32 + log_len;
+ UINT8 *bytes = generate_random_bytes(size);
- //Set reserved areas to zero.
- UINT64* validation = (UINT64*)(bytes + 4);
- *validation &= 0b111;
- UINT16* slot_number = (UINT16*)(bytes + 21);
- *slot_number &= ~0b111; //Device ID slot number bits 0-2.
- *(bytes + 23) = 0; //Device ID byte 11.
+ //Set reserved areas to zero.
+ UINT32 *validation = (UINT32 *)(bytes + 4);
+ *validation &= 0x7;
+ *(validation + 1) = 0;
+ UINT8 *slot_number = (UINT8 *)(bytes + 21);
+ *slot_number &= ~0x7; //Device ID slot number bits 0-2.
+ *(bytes + 23) = 0; //Device ID byte 11.
- //Set expected values.
- UINT32* length = (UINT32*)bytes;
- *length = size;
-
- //Set return values, exit.
- *location = bytes;
- return size;
-}
\ No newline at end of file
+ //Set expected values.
+ UINT32 *length = (UINT32 *)bytes;
+ *length = size;
+
+ //Set return values, exit.
+ *location = bytes;
+ return size;
+}