Skip to content

Commit d8904ca

Browse files
committed
Merge tag 'amd-drm-fixes-5.8-2020-07-22' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
amd-drm-fixes-5.8-2020-07-22: amdgpu: - Fix crash when overclocking VegaM - Fix possible crash when editing dpm levels Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 26a2be0 + 38e0c89 commit d8904ca

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,7 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
778778
tmp_str++;
779779
while (isspace(*++tmp_str));
780780

781-
while (tmp_str[0]) {
782-
sub_str = strsep(&tmp_str, delimiter);
781+
while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
783782
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
784783
if (ret)
785784
return -EINVAL;
@@ -1039,8 +1038,7 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
10391038
memcpy(buf_cpy, buf, bytes);
10401039
buf_cpy[bytes] = '\0';
10411040
tmp = buf_cpy;
1042-
while (tmp[0]) {
1043-
sub_str = strsep(&tmp, delimiter);
1041+
while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
10441042
if (strlen(sub_str)) {
10451043
ret = kstrtol(sub_str, 0, &level);
10461044
if (ret)
@@ -1637,8 +1635,7 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
16371635
i++;
16381636
memcpy(buf_cpy, buf, count-i);
16391637
tmp_str = buf_cpy;
1640-
while (tmp_str[0]) {
1641-
sub_str = strsep(&tmp_str, delimiter);
1638+
while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
16421639
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
16431640
if (ret)
16441641
return -EINVAL;

drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,18 +644,20 @@ static int vegam_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
644644

645645
/* sclk is bigger than max sclk in the dependence table */
646646
*voltage |= (dep_table->entries[i - 1].vddc * VOLTAGE_SCALE) << VDDC_SHIFT;
647-
vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
648-
(dep_table->entries[i - 1].vddc -
649-
(uint16_t)VDDC_VDDCI_DELTA));
650647

651648
if (SMU7_VOLTAGE_CONTROL_NONE == data->vddci_control)
652649
*voltage |= (data->vbios_boot_state.vddci_bootup_value *
653650
VOLTAGE_SCALE) << VDDCI_SHIFT;
654651
else if (dep_table->entries[i - 1].vddci)
655652
*voltage |= (dep_table->entries[i - 1].vddci *
656653
VOLTAGE_SCALE) << VDDC_SHIFT;
657-
else
654+
else {
655+
vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
656+
(dep_table->entries[i - 1].vddc -
657+
(uint16_t)VDDC_VDDCI_DELTA));
658+
658659
*voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
660+
}
659661

660662
if (SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control)
661663
*mvdd = data->vbios_boot_state.mvdd_bootup_value * VOLTAGE_SCALE;

0 commit comments

Comments
 (0)