diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-09-27 14:20:41 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-09-29 17:30:00 -0400 |
commit | 0069a2273837f199cb93d539a64daeba072a5a2a (patch) | |
tree | 28c43c7c823796a18a5583a7d65de3830349151d /drivers/gpu/drm/amd/display/dc/bios/command_table2.c | |
parent | 0de5472a01804f43b7c8ddb1132bbfeb8b68674f (diff) | |
download | linux-0069a2273837f199cb93d539a64daeba072a5a2a.tar.gz linux-0069a2273837f199cb93d539a64daeba072a5a2a.tar.bz2 linux-0069a2273837f199cb93d539a64daeba072a5a2a.zip |
gpu: amd: replace open-coded offsetof() with builtin
The two AMD drivers have their own custom offsetof() implementation
that now triggers a warning with recent versions of clang:
drivers/gpu/drm/radeon/radeon_atombios.c:133:14: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
Change all the instances to use the normal offsetof() provided
by the kernel that does not have this problem.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/bios/command_table2.c')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/bios/command_table2.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c index 6e333b4af7d6..9afa5eb2e6d3 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c @@ -44,9 +44,7 @@ bp->base.ctx->logger #define GET_INDEX_INTO_MASTER_TABLE(MasterOrData, FieldName)\ - (((char *)(&((\ - struct atom_master_list_of_##MasterOrData##_functions_v2_1 *)0)\ - ->FieldName)-(char *)0)/sizeof(uint16_t)) + (offsetof(struct atom_master_list_of_##MasterOrData##_functions_v2_1, FieldName) / sizeof(uint16_t)) #define EXEC_BIOS_CMD_TABLE(fname, params)\ (amdgpu_atom_execute_table(((struct amdgpu_device *)bp->base.ctx->driver_context)->mode_info.atom_context, \ |