[PATCH] drm/amd/pm: correct string parsing for extra separator characters case

Evan Quan evan.quan at amd.com
Thu Jan 21 08:41:31 UTC 2021


Supplement of previous fix "2d873f24dfaf drm/amdgpu/pm: Account for extra
separator characters in sysfs interface".

Change-Id: Ie9e9a78ad8530ba4b46ea27e28559d5dcda5c033
Signed-off-by: Evan Quan <evan.quan at amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index ba1539f6e0ce..ac150e63dd25 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -1866,6 +1866,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
 		memcpy(buf_cpy, buf, count-i);
 		tmp_str = buf_cpy;
 		while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+			if (strlen(sub_str) == 0)
+				continue;
 			ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
 			if (ret)
 				return -EINVAL;
-- 
2.29.0



More information about the amd-gfx mailing list