Skip to content

Commit 6e60cba

Browse files
jonathangrayalexdeucher
authored andcommitted
drm/amd/display: avoid unaligned access warnings
When building on OpenBSD/arm64 with clang 15, unaligned access warnings are seen when a union is embedded inside a packed struct. drm/amd/display/dmub/inc/dmub_cmd.h:941:18: error: field cursor_copy_src within 'struct dmub_rb_cmd_mall' is less aligned than 'union dmub_addr' and is usually due to 'struct dmub_rb_cmd_mall' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] union dmub_addr cursor_copy_src; /**< Cursor copy address */ ^ drm/amd/display/dmub/inc/dmub_cmd.h:942:18: error: field cursor_copy_dst within 'struct dmub_rb_cmd_mall' is less aligned than 'union dmub_addr' and is usually due to 'struct dmub_rb_cmd_mall' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access] union dmub_addr cursor_copy_dst; /**< Cursor copy destination */ ^ Add pragma pack around dmub_addr to avoid this. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent e26b51c commit 6e60cba

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ extern "C" {
162162
#define dmub_udelay(microseconds) udelay(microseconds)
163163
#endif
164164

165+
#pragma pack(push, 1)
165166
/**
166167
* union dmub_addr - DMUB physical/virtual 64-bit address.
167168
*/
@@ -172,6 +173,7 @@ union dmub_addr {
172173
} u; /*<< Low/high bit access */
173174
uint64_t quad_part; /*<< 64 bit address */
174175
};
176+
#pragma pack(pop)
175177

176178
/**
177179
* Dirty rect definition.

0 commit comments

Comments
 (0)