mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
efi_selftest: clean up unaligned unit test
* fix typo %s/give/given/ * don't use void * in pointer arithmetic Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
1b2c3e543c
commit
0db8221f32
1 changed files with 4 additions and 5 deletions
|
@ -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
|
* If the address is not four byte aligned, an unaligned memory access
|
||||||
* occurs.
|
* occurs.
|
||||||
*
|
*
|
||||||
* @addr: address to read
|
* @addr: address to read
|
||||||
* Return: value at the address
|
* Return: value at the address
|
||||||
*/
|
*/
|
||||||
static inline u32 deref(u32 *addr)
|
static inline u32 deref(void *addr)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -44,11 +44,10 @@ static int execute(void)
|
||||||
struct aligned_buffer buf = {
|
struct aligned_buffer buf = {
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7},
|
{0, 1, 2, 3, 4, 5, 6, 7},
|
||||||
};
|
};
|
||||||
void *v = &buf;
|
|
||||||
u32 r = 0;
|
u32 r = 0;
|
||||||
|
|
||||||
/* Read an unaligned address */
|
/* Read an unaligned address */
|
||||||
r = deref(v + 1);
|
r = deref(&buf.a[1]);
|
||||||
|
|
||||||
/* UEFI only supports low endian systems */
|
/* UEFI only supports low endian systems */
|
||||||
if (r != 0x04030201) {
|
if (r != 0x04030201) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue