* [PATCH] drm/amd/powerplay: remove variable 'result' set but not used
@ 2019-11-16 3:43 Chen Wandun
2019-11-18 6:50 ` Quan, Evan
2019-11-18 8:03 ` [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur Chen Wandun
0 siblings, 2 replies; 6+ messages in thread
From: Chen Wandun @ 2019-11-16 3:43 UTC (permalink / raw)
To: alexander.deucher, evan.quan, amd-gfx, dri-devel, linux-kernel; +Cc: chenwandun
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In function vegam_populate_smc_boot_level:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:6: warning: variable result set but not used [-Wunused-but-set-variable]
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 2068eb0..fad78bf 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -1361,20 +1361,19 @@ static int vegam_populate_smc_uvd_level(struct pp_hwmgr *hwmgr,
static int vegam_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
struct SMU75_Discrete_DpmTable *table)
{
- int result = 0;
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
table->GraphicsBootLevel = 0;
table->MemoryBootLevel = 0;
/* find boot level from dpm table */
- result = phm_find_boot_level(&(data->dpm_table.sclk_table),
- data->vbios_boot_state.sclk_bootup_value,
- (uint32_t *)&(table->GraphicsBootLevel));
+ phm_find_boot_level(&(data->dpm_table.sclk_table),
+ data->vbios_boot_state.sclk_bootup_value,
+ (uint32_t *)&(table->GraphicsBootLevel));
- result = phm_find_boot_level(&(data->dpm_table.mclk_table),
- data->vbios_boot_state.mclk_bootup_value,
- (uint32_t *)&(table->MemoryBootLevel));
+ phm_find_boot_level(&(data->dpm_table.mclk_table),
+ data->vbios_boot_state.mclk_bootup_value,
+ (uint32_t *)&(table->MemoryBootLevel));
table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
VOLTAGE_SCALE;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] drm/amd/powerplay: remove variable 'result' set but not used
2019-11-16 3:43 [PATCH] drm/amd/powerplay: remove variable 'result' set but not used Chen Wandun
@ 2019-11-18 6:50 ` Quan, Evan
2019-11-18 7:16 ` Chen Wandun
2019-11-18 8:03 ` [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur Chen Wandun
1 sibling, 1 reply; 6+ messages in thread
From: Quan, Evan @ 2019-11-18 6:50 UTC (permalink / raw)
To: Chen Wandun, Deucher, Alexander, amd-gfx, dri-devel, linux-kernel
Thanks. But it's better to return the 'result' out on 'result != 0'.
Regards,
Evan
-----Original Message-----
From: Chen Wandun <chenwandun@huawei.com>
Sent: Saturday, November 16, 2019 11:43 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
Cc: chenwandun@huawei.com
Subject: [PATCH] drm/amd/powerplay: remove variable 'result' set but not used
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In function vegam_populate_smc_boot_level:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:6: warning: variable result set but not used [-Wunused-but-set-variable]
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 2068eb0..fad78bf 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -1361,20 +1361,19 @@ static int vegam_populate_smc_uvd_level(struct pp_hwmgr *hwmgr,
static int vegam_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
struct SMU75_Discrete_DpmTable *table)
{
- int result = 0;
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
table->GraphicsBootLevel = 0;
table->MemoryBootLevel = 0;
/* find boot level from dpm table */
- result = phm_find_boot_level(&(data->dpm_table.sclk_table),
- data->vbios_boot_state.sclk_bootup_value,
- (uint32_t *)&(table->GraphicsBootLevel));
+ phm_find_boot_level(&(data->dpm_table.sclk_table),
+ data->vbios_boot_state.sclk_bootup_value,
+ (uint32_t *)&(table->GraphicsBootLevel));
- result = phm_find_boot_level(&(data->dpm_table.mclk_table),
- data->vbios_boot_state.mclk_bootup_value,
- (uint32_t *)&(table->MemoryBootLevel));
+ phm_find_boot_level(&(data->dpm_table.mclk_table),
+ data->vbios_boot_state.mclk_bootup_value,
+ (uint32_t *)&(table->MemoryBootLevel));
table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
VOLTAGE_SCALE;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amd/powerplay: remove variable 'result' set but not used
2019-11-18 6:50 ` Quan, Evan
@ 2019-11-18 7:16 ` Chen Wandun
0 siblings, 0 replies; 6+ messages in thread
From: Chen Wandun @ 2019-11-18 7:16 UTC (permalink / raw)
To: Quan, Evan, Deucher, Alexander, amd-gfx, dri-devel, linux-kernel
OK, it indeed should return the 'result' to caller,
I will make a modification and repost the patch.
Thanks
Chen Wandun
On 2019/11/18 14:50, Quan, Evan wrote:
> Thanks. But it's better to return the 'result' out on 'result != 0'.
>
> Regards,
> Evan
> -----Original Message-----
> From: Chen Wandun <chenwandun@huawei.com>
> Sent: Saturday, November 16, 2019 11:43 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
> Cc: chenwandun@huawei.com
> Subject: [PATCH] drm/amd/powerplay: remove variable 'result' set but not used
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In function vegam_populate_smc_boot_level:
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:6: warning: variable result set but not used [-Wunused-but-set-variable]
>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> ---
> drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> index 2068eb0..fad78bf 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> @@ -1361,20 +1361,19 @@ static int vegam_populate_smc_uvd_level(struct pp_hwmgr *hwmgr,
> static int vegam_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
> struct SMU75_Discrete_DpmTable *table)
> {
> - int result = 0;
> struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
>
> table->GraphicsBootLevel = 0;
> table->MemoryBootLevel = 0;
>
> /* find boot level from dpm table */
> - result = phm_find_boot_level(&(data->dpm_table.sclk_table),
> - data->vbios_boot_state.sclk_bootup_value,
> - (uint32_t *)&(table->GraphicsBootLevel));
> + phm_find_boot_level(&(data->dpm_table.sclk_table),
> + data->vbios_boot_state.sclk_bootup_value,
> + (uint32_t *)&(table->GraphicsBootLevel));
>
> - result = phm_find_boot_level(&(data->dpm_table.mclk_table),
> - data->vbios_boot_state.mclk_bootup_value,
> - (uint32_t *)&(table->MemoryBootLevel));
> + phm_find_boot_level(&(data->dpm_table.mclk_table),
> + data->vbios_boot_state.mclk_bootup_value,
> + (uint32_t *)&(table->MemoryBootLevel));
>
> table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
> VOLTAGE_SCALE;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur
2019-11-16 3:43 [PATCH] drm/amd/powerplay: remove variable 'result' set but not used Chen Wandun
2019-11-18 6:50 ` Quan, Evan
@ 2019-11-18 8:03 ` Chen Wandun
2019-11-18 8:15 ` Quan, Evan
1 sibling, 1 reply; 6+ messages in thread
From: Chen Wandun @ 2019-11-18 8:03 UTC (permalink / raw)
To: evan.quan, alexander.deucher, amd-gfx, linux-kernel, dri-devel; +Cc: chenwandun
return errno code to caller when error occur, and meanwhile
remove gcc '-Wunused-but-set-variable' warning.
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In function vegam_populate_smc_boot_level:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:6: warning: variable result set but not used [-Wunused-but-set-variable]
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
index 2068eb0..50896e9 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
@@ -1371,11 +1371,16 @@ static int vegam_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
result = phm_find_boot_level(&(data->dpm_table.sclk_table),
data->vbios_boot_state.sclk_bootup_value,
(uint32_t *)&(table->GraphicsBootLevel));
+ if (result)
+ return result;
result = phm_find_boot_level(&(data->dpm_table.mclk_table),
data->vbios_boot_state.mclk_bootup_value,
(uint32_t *)&(table->MemoryBootLevel));
+ if (result)
+ return result;
+
table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
VOLTAGE_SCALE;
table->BootVddci = data->vbios_boot_state.vddci_bootup_value *
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur
2019-11-18 8:03 ` [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur Chen Wandun
@ 2019-11-18 8:15 ` Quan, Evan
2019-11-18 20:24 ` Alex Deucher
0 siblings, 1 reply; 6+ messages in thread
From: Quan, Evan @ 2019-11-18 8:15 UTC (permalink / raw)
To: Chen Wandun, Deucher, Alexander, amd-gfx, linux-kernel, dri-devel
Reviewed-by: Evan Quan <evan.quan@amd.com>
> -----Original Message-----
> From: Chen Wandun <chenwandun@huawei.com>
> Sent: Monday, November 18, 2019 4:04 PM
> To: Quan, Evan <Evan.Quan@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org; linux-
> kernel@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: chenwandun@huawei.com
> Subject: [PATCH v2] drm/amd/powerplay: return errno code to caller when
> error occur
>
> return errno code to caller when error occur, and meanwhile remove gcc '-
> Wunused-but-set-variable' warning.
>
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In
> function vegam_populate_smc_boot_level:
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:
> 6: warning: variable result set but not used [-Wunused-but-set-variable]
>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> ---
> drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> index 2068eb0..50896e9 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> @@ -1371,11 +1371,16 @@ static int vegam_populate_smc_boot_level(struct
> pp_hwmgr *hwmgr,
> result = phm_find_boot_level(&(data->dpm_table.sclk_table),
> data->vbios_boot_state.sclk_bootup_value,
> (uint32_t *)&(table->GraphicsBootLevel));
> + if (result)
> + return result;
>
> result = phm_find_boot_level(&(data->dpm_table.mclk_table),
> data->vbios_boot_state.mclk_bootup_value,
> (uint32_t *)&(table->MemoryBootLevel));
>
> + if (result)
> + return result;
> +
> table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
> VOLTAGE_SCALE;
> table->BootVddci = data->vbios_boot_state.vddci_bootup_value *
> --
> 2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur
2019-11-18 8:15 ` Quan, Evan
@ 2019-11-18 20:24 ` Alex Deucher
0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2019-11-18 20:24 UTC (permalink / raw)
To: Quan, Evan
Cc: Chen Wandun, Deucher, Alexander, amd-gfx, linux-kernel, dri-devel
Applied. Thanks!
Alex
On Mon, Nov 18, 2019 at 3:15 AM Quan, Evan <Evan.Quan@amd.com> wrote:
>
> Reviewed-by: Evan Quan <evan.quan@amd.com>
>
> > -----Original Message-----
> > From: Chen Wandun <chenwandun@huawei.com>
> > Sent: Monday, November 18, 2019 4:04 PM
> > To: Quan, Evan <Evan.Quan@amd.com>; Deucher, Alexander
> > <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org; linux-
> > kernel@vger.kernel.org; dri-devel@lists.freedesktop.org
> > Cc: chenwandun@huawei.com
> > Subject: [PATCH v2] drm/amd/powerplay: return errno code to caller when
> > error occur
> >
> > return errno code to caller when error occur, and meanwhile remove gcc '-
> > Wunused-but-set-variable' warning.
> >
> > drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c: In
> > function vegam_populate_smc_boot_level:
> > drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vegam_smumgr.c:1364:
> > 6: warning: variable result set but not used [-Wunused-but-set-variable]
> >
> > Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> > ---
> > drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > index 2068eb0..50896e9 100644
> > --- a/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c
> > @@ -1371,11 +1371,16 @@ static int vegam_populate_smc_boot_level(struct
> > pp_hwmgr *hwmgr,
> > result = phm_find_boot_level(&(data->dpm_table.sclk_table),
> > data->vbios_boot_state.sclk_bootup_value,
> > (uint32_t *)&(table->GraphicsBootLevel));
> > + if (result)
> > + return result;
> >
> > result = phm_find_boot_level(&(data->dpm_table.mclk_table),
> > data->vbios_boot_state.mclk_bootup_value,
> > (uint32_t *)&(table->MemoryBootLevel));
> >
> > + if (result)
> > + return result;
> > +
> > table->BootVddc = data->vbios_boot_state.vddc_bootup_value *
> > VOLTAGE_SCALE;
> > table->BootVddci = data->vbios_boot_state.vddci_bootup_value *
> > --
> > 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-18 20:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 3:43 [PATCH] drm/amd/powerplay: remove variable 'result' set but not used Chen Wandun
2019-11-18 6:50 ` Quan, Evan
2019-11-18 7:16 ` Chen Wandun
2019-11-18 8:03 ` [PATCH v2] drm/amd/powerplay: return errno code to caller when error occur Chen Wandun
2019-11-18 8:15 ` Quan, Evan
2019-11-18 20:24 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).