diff options
author | Wang Xiayang <xywang.sjtu@sjtu.edu.cn> | 2019-07-15 04:53:01 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-07-16 14:09:09 -0400 |
commit | 3bd532692d93a9c72f4f11e38437b30c0e13007f (patch) | |
tree | fc5570beb6b25232812b4b663f30c76b036ec839 | |
parent | 5db7b0d29086b621e294d5c52bb3ff25283cff60 (diff) |
drm/amdgpu: replace simple_strtol() by kstrtou32()
The simple_strtol() function is deprecated. kstrto[l,u32]() is
the correct replacement as it can properly handle overflows.
This patch replaces the deprecated simple_strtol() use introduced recently.
As clk is of type uint32_t, we are safe to use kstrtou32().
It is also safe to return zero on string parsing error,
similar to the case of returning zero if buf is empty in parse_clk().
Fixes: bb5a2bdf36a8 ("drm/amdgpu: support dpm level modification under virtualization v3")
Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 07a7e3820b7b..59dd204498c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | |||
@@ -390,7 +390,8 @@ static uint32_t parse_clk(char *buf, bool min) | |||
390 | if (!ptr) | 390 | if (!ptr) |
391 | break; | 391 | break; |
392 | ptr+=2; | 392 | ptr+=2; |
393 | clk = simple_strtoul(ptr, NULL, 10); | 393 | if (kstrtou32(ptr, 10, &clk)) |
394 | return 0; | ||
394 | } while (!min); | 395 | } while (!min); |
395 | 396 | ||
396 | return clk * 100; | 397 | return clk * 100; |