Skip to content

Commit beaf10e

Browse files
committed
drm/amdgpu: use %u rather than %d for sclk/mclk
Large clock values may overflow and show up as negative. Reported by prOMiNd on IRC. Acked-by: Nirmoy Das <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent d7a6634 commit beaf10e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,7 @@ static ssize_t amdgpu_hwmon_show_sclk(struct device *dev,
27842784
if (r)
27852785
return r;
27862786

2787-
return snprintf(buf, PAGE_SIZE, "%d\n", sclk * 10 * 1000);
2787+
return snprintf(buf, PAGE_SIZE, "%u\n", sclk * 10 * 1000);
27882788
}
27892789

27902790
static ssize_t amdgpu_hwmon_show_sclk_label(struct device *dev,
@@ -2819,7 +2819,7 @@ static ssize_t amdgpu_hwmon_show_mclk(struct device *dev,
28192819
if (r)
28202820
return r;
28212821

2822-
return snprintf(buf, PAGE_SIZE, "%d\n", mclk * 10 * 1000);
2822+
return snprintf(buf, PAGE_SIZE, "%u\n", mclk * 10 * 1000);
28232823
}
28242824

28252825
static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,

0 commit comments

Comments
 (0)