Commit aa842d73 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: gcc fixes for rv6xx dpm

Newer versions of gcc seem to wander off into the
weeds when dealing with variable sizes arrays in
structs.  Rather than indexing the arrays, use
pointer arithmetic.

See bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=66932
https://bugs.freedesktop.org/show_bug.cgi?id=66972
https://bugs.freedesktop.org/show_bug.cgi?id=66945Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 607f2c27
...@@ -1918,6 +1918,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) ...@@ -1918,6 +1918,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
(power_state->v1.ucNonClockStateIndex * (power_state->v1.ucNonClockStateIndex *
power_info->pplib.ucNonClockSize)); power_info->pplib.ucNonClockSize));
if (power_info->pplib.ucStateEntrySize - 1) { if (power_info->pplib.ucStateEntrySize - 1) {
u8 *idx;
ps = kzalloc(sizeof(struct rv6xx_ps), GFP_KERNEL); ps = kzalloc(sizeof(struct rv6xx_ps), GFP_KERNEL);
if (ps == NULL) { if (ps == NULL) {
kfree(rdev->pm.dpm.ps); kfree(rdev->pm.dpm.ps);
...@@ -1926,12 +1927,12 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) ...@@ -1926,12 +1927,12 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
rdev->pm.dpm.ps[i].ps_priv = ps; rdev->pm.dpm.ps[i].ps_priv = ps;
rv6xx_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i], rv6xx_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i],
non_clock_info); non_clock_info);
idx = (u8 *)&power_state->v1.ucClockStateIndices[0];
for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) { for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) {
clock_info = (union pplib_clock_info *) clock_info = (union pplib_clock_info *)
(mode_info->atom_context->bios + data_offset + (mode_info->atom_context->bios + data_offset +
le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) + le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) +
(power_state->v1.ucClockStateIndices[j] * (idx[j] * power_info->pplib.ucClockInfoSize));
power_info->pplib.ucClockInfoSize));
rv6xx_parse_pplib_clock_info(rdev, rv6xx_parse_pplib_clock_info(rdev,
&rdev->pm.dpm.ps[i], j, &rdev->pm.dpm.ps[i], j,
clock_info); clock_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment