[radeon-alex:drm-next-4.17-wip 151/209] drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:414 amdgpu_set_pp_od_clk_voltage() error: uninitialized symbol 'ret'.
Dan Carpenter
dan.carpenter at oracle.com
Tue Jan 30 19:16:05 UTC 2018
tree: git://people.freedesktop.org/~agd5f/linux.git drm-next-4.17-wip
head: 5d9e45135f05706b787fe2882442a78f92ae9cd1
commit: c0d382de6b810f9560a22d0d7e5837351265cd7b [151/209] drm/amd/pp: Add edit/commit/show OD clock/voltage support in sysfs
smatch warnings:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:414 amdgpu_set_pp_od_clk_voltage() error: uninitialized symbol 'ret'.
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout c0d382de6b810f9560a22d0d7e5837351265cd7b
vim +/ret +414 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
f3898ea1 Eric Huang 2015-12-11 362
c0d382de Rex Zhu 2018-01-16 363 static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
c0d382de Rex Zhu 2018-01-16 364 struct device_attribute *attr,
c0d382de Rex Zhu 2018-01-16 365 const char *buf,
c0d382de Rex Zhu 2018-01-16 366 size_t count)
c0d382de Rex Zhu 2018-01-16 367 {
c0d382de Rex Zhu 2018-01-16 368 struct drm_device *ddev = dev_get_drvdata(dev);
c0d382de Rex Zhu 2018-01-16 369 struct amdgpu_device *adev = ddev->dev_private;
c0d382de Rex Zhu 2018-01-16 370 int ret;
c0d382de Rex Zhu 2018-01-16 371 uint32_t parameter_size = 0;
c0d382de Rex Zhu 2018-01-16 372 long parameter[64];
c0d382de Rex Zhu 2018-01-16 373 char buf_cpy[128];
c0d382de Rex Zhu 2018-01-16 374 char *tmp_str;
c0d382de Rex Zhu 2018-01-16 375 char *sub_str;
c0d382de Rex Zhu 2018-01-16 376 const char delimiter[3] = {' ', '\n', '\0'};
c0d382de Rex Zhu 2018-01-16 377 uint32_t type;
c0d382de Rex Zhu 2018-01-16 378
c0d382de Rex Zhu 2018-01-16 379 if (count > 127)
c0d382de Rex Zhu 2018-01-16 380 return -EINVAL;
c0d382de Rex Zhu 2018-01-16 381
c0d382de Rex Zhu 2018-01-16 382 if (*buf == 's')
c0d382de Rex Zhu 2018-01-16 383 type = PP_OD_EDIT_SCLK_VDDC_TABLE;
c0d382de Rex Zhu 2018-01-16 384 else if (*buf == 'm')
c0d382de Rex Zhu 2018-01-16 385 type = PP_OD_EDIT_MCLK_VDDC_TABLE;
c0d382de Rex Zhu 2018-01-16 386 else if(*buf == 'r')
c0d382de Rex Zhu 2018-01-16 387 type = PP_OD_RESTORE_DEFAULT_TABLE;
c0d382de Rex Zhu 2018-01-16 388 else if (*buf == 'c')
c0d382de Rex Zhu 2018-01-16 389 type = PP_OD_COMMIT_DPM_TABLE;
c0d382de Rex Zhu 2018-01-16 390 else
c0d382de Rex Zhu 2018-01-16 391 return -EINVAL;
c0d382de Rex Zhu 2018-01-16 392
c0d382de Rex Zhu 2018-01-16 393 memcpy(buf_cpy, buf, count+1);
c0d382de Rex Zhu 2018-01-16 394
c0d382de Rex Zhu 2018-01-16 395 tmp_str = buf_cpy;
c0d382de Rex Zhu 2018-01-16 396
c0d382de Rex Zhu 2018-01-16 397 while (isspace(*++tmp_str));
c0d382de Rex Zhu 2018-01-16 398
c0d382de Rex Zhu 2018-01-16 399 while (tmp_str[0]) {
Assume tmp_str[0] is the NUL char.
c0d382de Rex Zhu 2018-01-16 400 sub_str = strsep(&tmp_str, delimiter);
c0d382de Rex Zhu 2018-01-16 401 ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);
c0d382de Rex Zhu 2018-01-16 402 if (ret)
c0d382de Rex Zhu 2018-01-16 403 return -EINVAL;
c0d382de Rex Zhu 2018-01-16 404 parameter_size++;
c0d382de Rex Zhu 2018-01-16 405
c0d382de Rex Zhu 2018-01-16 406 while (isspace(*tmp_str))
c0d382de Rex Zhu 2018-01-16 407 tmp_str++;
c0d382de Rex Zhu 2018-01-16 408 }
c0d382de Rex Zhu 2018-01-16 409
c0d382de Rex Zhu 2018-01-16 410 if (adev->powerplay.pp_funcs->odn_edit_dpm_table)
And this is false.
c0d382de Rex Zhu 2018-01-16 411 ret = amdgpu_dpm_odn_edit_dpm_table(adev, type,
c0d382de Rex Zhu 2018-01-16 412 parameter, parameter_size);
c0d382de Rex Zhu 2018-01-16 413
c0d382de Rex Zhu 2018-01-16 @414 if (ret)
Then "ret" is uninitialized.
c0d382de Rex Zhu 2018-01-16 415 return -EINVAL;
c0d382de Rex Zhu 2018-01-16 416
c0d382de Rex Zhu 2018-01-16 417 if (type == PP_OD_COMMIT_DPM_TABLE) {
c0d382de Rex Zhu 2018-01-16 418 if (adev->powerplay.pp_funcs->dispatch_tasks) {
c0d382de Rex Zhu 2018-01-16 419 amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL);
c0d382de Rex Zhu 2018-01-16 420 return count;
c0d382de Rex Zhu 2018-01-16 421 } else {
c0d382de Rex Zhu 2018-01-16 422 return -EINVAL;
c0d382de Rex Zhu 2018-01-16 423 }
c0d382de Rex Zhu 2018-01-16 424 }
c0d382de Rex Zhu 2018-01-16 425
c0d382de Rex Zhu 2018-01-16 426 return count;
c0d382de Rex Zhu 2018-01-16 427 }
c0d382de Rex Zhu 2018-01-16 428
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
More information about the dri-devel
mailing list