]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_selftest: clean up unaligned unit test
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 1 May 2022 09:24:22 +0000 (11:24 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 3 May 2022 19:39:22 +0000 (21:39 +0200)
* fix typo %s/give/given/
* don't use void * in pointer arithmetic

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_selftest/efi_selftest_unaligned.c

index 6fce110b76f7636bd048e8e5e7155123e9f50e0d..7c6bf2d6e8d4b3ddaa76c73a9b5406f09ece43f7 100644 (file)
@@ -14,14 +14,14 @@ struct aligned_buffer {
 };
 
 /*
- * Return an u32 at a give address.
+ * Return an u32 at a given address.
  * If the address is not four byte aligned, an unaligned memory access
  * occurs.
  *
  * @addr:      address to read
  * Return:     value at the address
  */
-static inline u32 deref(u32 *addr)
+static inline u32 deref(void *addr)
 {
        int ret;
 
@@ -43,12 +43,11 @@ static int execute(void)
 {
        struct aligned_buffer buf = {
                {0, 1, 2, 3, 4, 5, 6, 7},
-               };
-       void *v = &buf;
+       };
        u32 r = 0;
 
        /* Read an unaligned address */
-       r = deref(v + 1);
+       r = deref(&buf.a[1]);
 
        /* UEFI only supports low endian systems */
        if (r != 0x04030201) {