Fix variable set but not used compilation warning:
./vangogh_ppt.c:397:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
int ret = 0;
^~~
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
---
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 6e26025..355ade5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -394,8 +394,6 @@ static int vangogh_get_current_activity_percent(struct smu_context *smu,
enum amd_pp_sensors sensor,
uint32_t *value)
{
- int ret = 0;
-
if (!value)
return -EINVAL;
--
2.6.2
Hi Zou,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20201102]
url: https://github.com/0day-ci/linux/commits/Zou-Wei/drm-amd-pm-remove-unused-variable/20201102-195853
base: b49976d8ef6448e86a7fda6a86f64867942b442d
config: x86_64-randconfig-a004-20201102 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cc91554ebb66e8c9a4b8c67ca2f1343eaac10cf6)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/4a14c85aff468b2d26c02415991b440b0b56fc75
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zou-Wei/drm-amd-pm-remove-unused-variable/20201102-195853
git checkout 4a14c85aff468b2d26c02415991b440b0b56fc75
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:402:3: error: use of undeclared identifier 'ret'
ret = vangogh_get_smu_metrics_data(smu,
^
1 error generated.
vim +/ret +402 drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c
271ab489f755245 Xiaojian Du 2020-10-26 392
271ab489f755245 Xiaojian Du 2020-10-26 393 static int vangogh_get_current_activity_percent(struct smu_context *smu,
271ab489f755245 Xiaojian Du 2020-10-26 394 enum amd_pp_sensors sensor,
271ab489f755245 Xiaojian Du 2020-10-26 395 uint32_t *value)
271ab489f755245 Xiaojian Du 2020-10-26 396 {
271ab489f755245 Xiaojian Du 2020-10-26 397 if (!value)
271ab489f755245 Xiaojian Du 2020-10-26 398 return -EINVAL;
271ab489f755245 Xiaojian Du 2020-10-26 399
271ab489f755245 Xiaojian Du 2020-10-26 400 switch (sensor) {
271ab489f755245 Xiaojian Du 2020-10-26 401 case AMDGPU_PP_SENSOR_GPU_LOAD:
271ab489f755245 Xiaojian Du 2020-10-26 @402 ret = vangogh_get_smu_metrics_data(smu,
271ab489f755245 Xiaojian Du 2020-10-26 403 METRICS_AVERAGE_GFXACTIVITY,
271ab489f755245 Xiaojian Du 2020-10-26 404 value);
271ab489f755245 Xiaojian Du 2020-10-26 405 break;
271ab489f755245 Xiaojian Du 2020-10-26 406 default:
271ab489f755245 Xiaojian Du 2020-10-26 407 dev_err(smu->adev->dev, "Invalid sensor for retrieving clock activity\n");
271ab489f755245 Xiaojian Du 2020-10-26 408 return -EINVAL;
271ab489f755245 Xiaojian Du 2020-10-26 409 }
271ab489f755245 Xiaojian Du 2020-10-26 410
271ab489f755245 Xiaojian Du 2020-10-26 411 return 0;
271ab489f755245 Xiaojian Du 2020-10-26 412 }
271ab489f755245 Xiaojian Du 2020-10-26 413
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On Mon, Nov 2, 2020 at 8:44 AM Zou Wei <[email protected]> wrote:
>
> Fix variable set but not used compilation warning:
>
> ./vangogh_ppt.c:397:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> int ret = 0;
> ^~~
>
Maybe you have an older version of the code? It's currently used.
Alex
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zou Wei <[email protected]>
> ---
> drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> index 6e26025..355ade5 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
> @@ -394,8 +394,6 @@ static int vangogh_get_current_activity_percent(struct smu_context *smu,
> enum amd_pp_sensors sensor,
> uint32_t *value)
> {
> - int ret = 0;
> -
> if (!value)
> return -EINVAL;
>
> --
> 2.6.2
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel