diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/ni_dpm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/ni_dpm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index c7fbb7932f37..59cdadcece15 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -2685,11 +2685,12 @@ static int ni_upload_sw_state(struct radeon_device *rdev, struct rv7xx_power_info *pi = rv770_get_pi(rdev); u16 address = pi->state_table_start + offsetof(NISLANDS_SMC_STATETABLE, driverState); - u16 state_size = sizeof(NISLANDS_SMC_SWSTATE) + - ((NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1) * sizeof(NISLANDS_SMC_HW_PERFORMANCE_LEVEL)); + NISLANDS_SMC_SWSTATE *smc_state; + size_t state_size = struct_size(smc_state, levels, + NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE); int ret; - NISLANDS_SMC_SWSTATE *smc_state = kzalloc(state_size, GFP_KERNEL); + smc_state = kzalloc(state_size, GFP_KERNEL); if (smc_state == NULL) return -ENOMEM; |