* RE: [PATCH -next] drm/amdgpu: remove set but not used variable 'ring'
2018-11-15 10:52 [PATCH -next] drm/amdgpu: remove set but not used variable 'ring' YueHaibing
@ 2018-11-15 11:49 ` Huang, Ray
2018-11-15 11:56 ` YueHaibing
2019-02-20 3:31 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'vm, bo' YueHaibing
` (2 subsequent siblings)
3 siblings, 1 reply; 29+ messages in thread
From: Huang, Ray @ 2018-11-15 11:49 UTC (permalink / raw)
To: YueHaibing, Deucher, Alexander, Koenig, Christian, Zhou,
David(ChunMing),
airlied, Liu, Shaoyun, Francis, David, Xu, Feifei, Gao, Likun
Cc: amd-gfx, dri-devel, linux-kernel, kernel-janitors
> -----Original Message-----
> From: YueHaibing [mailto:yuehaibing@huawei.com]
> Sent: Thursday, November 15, 2018 6:52 PM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Zhou, David(ChunMing)
> <David1.Zhou@amd.com>; airlied@linux.ie; Liu, Shaoyun
> <Shaoyun.Liu@amd.com>; Francis, David <David.Francis@amd.com>; Huang,
> Ray <Ray.Huang@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Gao, Likun
> <Likun.Gao@amd.com>
> Cc: YueHaibing <yuehaibing@huawei.com>; amd-gfx@lists.freedesktop.org;
> dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH -next] drm/amdgpu: remove set but not used variable 'ring'
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c: In function
> 'psp_v10_0_ring_stop':
> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c:230:19: warning:
> variable 'ring' set but not used [-Wunused-but-set-variable]
>
> It not used since commit
> 4ef72453311a ("drm/amdgpu: added api for stopping psp ring (v2)")
Thanks, please also remove the similar code in psp_v3_1.
With that updates, patch is Reviewed-by: Huang Rui <ray.huang@amd.com>
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
> b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
> index 295c220..d78b430 100644
> --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
> @@ -240,12 +240,9 @@ static int psp_v10_0_ring_stop(struct psp_context
> *psp,
> enum psp_ring_type ring_type) {
> int ret = 0;
> - struct psp_ring *ring;
> unsigned int psp_ring_reg = 0;
> struct amdgpu_device *adev = psp->adev;
>
> - ring = &psp->km_ring;
> -
> /* Write the ring destroy command to C2PMSG_64 */
> psp_ring_reg = 3 << 16;
> WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
>
>
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variable 'ring'
2018-11-15 11:49 ` Huang, Ray
@ 2018-11-15 11:56 ` YueHaibing
0 siblings, 0 replies; 29+ messages in thread
From: YueHaibing @ 2018-11-15 11:56 UTC (permalink / raw)
To: Huang, Ray, Deucher, Alexander, Koenig, Christian, Zhou,
David(ChunMing),
airlied, Liu, Shaoyun, Francis, David, Xu, Feifei, Gao, Likun
Cc: amd-gfx, dri-devel, linux-kernel, kernel-janitors
On 2018/11/15 19:49, Huang, Ray wrote:
>> -----Original Message-----
>> From: YueHaibing [mailto:yuehaibing@huawei.com]
>> Sent: Thursday, November 15, 2018 6:52 PM
>> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
>> <Christian.Koenig@amd.com>; Zhou, David(ChunMing)
>> <David1.Zhou@amd.com>; airlied@linux.ie; Liu, Shaoyun
>> <Shaoyun.Liu@amd.com>; Francis, David <David.Francis@amd.com>; Huang,
>> Ray <Ray.Huang@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Gao, Likun
>> <Likun.Gao@amd.com>
>> Cc: YueHaibing <yuehaibing@huawei.com>; amd-gfx@lists.freedesktop.org;
>> dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; kernel-
>> janitors@vger.kernel.org
>> Subject: [PATCH -next] drm/amdgpu: remove set but not used variable 'ring'
>>
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c: In function
>> 'psp_v10_0_ring_stop':
>> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c:230:19: warning:
>> variable 'ring' set but not used [-Wunused-but-set-variable]
>>
>> It not used since commit
>> 4ef72453311a ("drm/amdgpu: added api for stopping psp ring (v2)")
>
> Thanks, please also remove the similar code in psp_v3_1.
> With that updates, patch is Reviewed-by: Huang Rui <ray.huang@amd.com>
>
Ok, will send v2.
>>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> index 295c220..d78b430 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
>> @@ -240,12 +240,9 @@ static int psp_v10_0_ring_stop(struct psp_context
>> *psp,
>> enum psp_ring_type ring_type) {
>> int ret = 0;
>> - struct psp_ring *ring;
>> unsigned int psp_ring_reg = 0;
>> struct amdgpu_device *adev = psp->adev;
>>
>> - ring = &psp->km_ring;
>> -
>> /* Write the ring destroy command to C2PMSG_64 */
>> psp_ring_reg = 3 << 16;
>> WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
>>
>>
>>
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH -next] drm/amdgpu: remove set but not used variables 'vm, bo'
2018-11-15 10:52 [PATCH -next] drm/amdgpu: remove set but not used variable 'ring' YueHaibing
2018-11-15 11:49 ` Huang, Ray
@ 2019-02-20 3:31 ` YueHaibing
2019-02-28 2:43 ` Alex Deucher
2019-06-22 2:56 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Mao Wenan
2020-07-02 1:55 ` [PATCH -next] drm/amdgpu: remove set but not used variable 'adev' YueHaibing
3 siblings, 1 reply; 29+ messages in thread
From: YueHaibing @ 2019-02-20 3:31 UTC (permalink / raw)
To: Oded Gabbay, alexander.deucher, christian.koenig, David1.Zhou,
airlied, daniel
Cc: YueHaibing, dri-devel, amd-gfx, linux-kernel, kernel-janitors
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function 'update_gpuvm_pte':
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:840:20: warning:
variable 'bo' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:838:20: warning:
variable 'vm' set but not used [-Wunused-but-set-variable]
They're never used since introduction in a46a2cd103a8 ("drm/amdgpu: Add GPUVM
memory management functions for KFD")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index d7b10d79f1de..63daf758cd03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -837,13 +837,7 @@ static int update_gpuvm_pte(struct amdgpu_device *adev,
struct amdgpu_sync *sync)
{
int ret;
- struct amdgpu_vm *vm;
- struct amdgpu_bo_va *bo_va;
- struct amdgpu_bo *bo;
-
- bo_va = entry->bo_va;
- vm = bo_va->base.vm;
- bo = bo_va->base.bo;
+ struct amdgpu_bo_va *bo_va = entry->bo_va;
/* Update the page tables */
ret = amdgpu_vm_bo_update(adev, bo_va, false);
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'vm, bo'
2019-02-20 3:31 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'vm, bo' YueHaibing
@ 2019-02-28 2:43 ` Alex Deucher
0 siblings, 0 replies; 29+ messages in thread
From: Alex Deucher @ 2019-02-28 2:43 UTC (permalink / raw)
To: YueHaibing
Cc: Oded Gabbay, Deucher, Alexander, Christian Koenig, Chunming Zhou,
Dave Airlie, Daniel Vetter, kernel-janitors, amd-gfx list,
Maling list - DRI developers, LKML
Applied. thanks!
On Wed, Feb 20, 2019 at 3:05 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function 'update_gpuvm_pte':
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:840:20: warning:
> variable 'bo' set but not used [-Wunused-but-set-variable]
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:838:20: warning:
> variable 'vm' set but not used [-Wunused-but-set-variable]
>
> They're never used since introduction in a46a2cd103a8 ("drm/amdgpu: Add GPUVM
> memory management functions for KFD")
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index d7b10d79f1de..63daf758cd03 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -837,13 +837,7 @@ static int update_gpuvm_pte(struct amdgpu_device *adev,
> struct amdgpu_sync *sync)
> {
> int ret;
> - struct amdgpu_vm *vm;
> - struct amdgpu_bo_va *bo_va;
> - struct amdgpu_bo *bo;
> -
> - bo_va = entry->bo_va;
> - vm = bo_va->base.vm;
> - bo = bo_va->base.bo;
> + struct amdgpu_bo_va *bo_va = entry->bo_va;
>
> /* Update the page tables */
> ret = amdgpu_vm_bo_update(adev, bo_va, false);
>
>
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2018-11-15 10:52 [PATCH -next] drm/amdgpu: remove set but not used variable 'ring' YueHaibing
2018-11-15 11:49 ` Huang, Ray
2019-02-20 3:31 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'vm, bo' YueHaibing
@ 2019-06-22 2:56 ` Mao Wenan
2019-06-22 6:02 ` Julia Lawall
2019-06-22 10:43 ` Dan Carpenter
2020-07-02 1:55 ` [PATCH -next] drm/amdgpu: remove set but not used variable 'adev' YueHaibing
3 siblings, 2 replies; 29+ messages in thread
From: Mao Wenan @ 2019-06-22 2:56 UTC (permalink / raw)
To: airlied, daniel, alexander.deucher, christian.koenig, David1.Zhou
Cc: kernel-janitors, amd-gfx, linux-kernel, Mao Wenan
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
int ret = 0;
^
It is never used since introduction in 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 0e6dba9..0bf4dd9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
/* init amdgpu_pmu */
int amdgpu_pmu_init(struct amdgpu_device *adev)
{
- int ret = 0;
-
switch (adev->asic_type) {
case CHIP_VEGA20:
/* init df */
- ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
+ init_pmu_by_type(adev, df_v3_6_attr_groups,
"DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
DF_V3_6_MAX_COUNTERS);
--
2.7.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2019-06-22 2:56 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Mao Wenan
@ 2019-06-22 6:02 ` Julia Lawall
2019-06-22 7:20 ` maowenan
2019-06-22 10:43 ` Dan Carpenter
1 sibling, 1 reply; 29+ messages in thread
From: Julia Lawall @ 2019-06-22 6:02 UTC (permalink / raw)
To: Mao Wenan
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, kernel-janitors, amd-gfx, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]
On Sat, 22 Jun 2019, Mao Wenan wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> int ret = 0;
> ^
>
> It is never used since introduction in 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 0e6dba9..0bf4dd9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
> /* init amdgpu_pmu */
> int amdgpu_pmu_init(struct amdgpu_device *adev)
> {
> - int ret = 0;
> -
> switch (adev->asic_type) {
> case CHIP_VEGA20:
> /* init df */
> - ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> + init_pmu_by_type(adev, df_v3_6_attr_groups,
> "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> DF_V3_6_MAX_COUNTERS);
Maybe it would be better to use ret?
If knowing whether the call has failed is really useless, then maybe the
return type should be void?
julia
>
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2019-06-22 6:02 ` Julia Lawall
@ 2019-06-22 7:20 ` maowenan
0 siblings, 0 replies; 29+ messages in thread
From: maowenan @ 2019-06-22 7:20 UTC (permalink / raw)
To: Julia Lawall
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, kernel-janitors, amd-gfx, linux-kernel
On 2019/6/22 14:02, Julia Lawall wrote:
>
>
> On Sat, 22 Jun 2019, Mao Wenan wrote:
>
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>> int ret = 0;
>> ^
>>
>> It is never used since introduction in 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
>>
>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> index 0e6dba9..0bf4dd9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
>> /* init amdgpu_pmu */
>> int amdgpu_pmu_init(struct amdgpu_device *adev)
>> {
>> - int ret = 0;
>> -
>> switch (adev->asic_type) {
>> case CHIP_VEGA20:
>> /* init df */
>> - ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>> + init_pmu_by_type(adev, df_v3_6_attr_groups,
>> "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>> DF_V3_6_MAX_COUNTERS);
>
> Maybe it would be better to use ret?
>
> If knowing whether the call has failed is really useless, then maybe the
> return type should be void?
right.
amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
which will use the return value.
amdgpu_device_init()
r = amdgpu_pmu_init(adev);
thanks, I will send v2.
>
> julia
>
>
>>
>> --
>> 2.7.4
>>
>>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2019-06-22 2:56 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Mao Wenan
2019-06-22 6:02 ` Julia Lawall
@ 2019-06-22 10:43 ` Dan Carpenter
2019-06-22 12:58 ` [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init Mao Wenan
2019-06-23 6:00 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Dan Carpenter
1 sibling, 2 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-06-22 10:43 UTC (permalink / raw)
To: Mao Wenan
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, kernel-janitors, amd-gfx, linux-kernel
On Sat, Jun 22, 2019 at 11:03:14AM +0800, Mao Wenan wrote:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 0e6dba9..0bf4dd9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
> /* init amdgpu_pmu */
> int amdgpu_pmu_init(struct amdgpu_device *adev)
> {
> - int ret = 0;
> -
> switch (adev->asic_type) {
> case CHIP_VEGA20:
> /* init df */
> - ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> + init_pmu_by_type(adev, df_v3_6_attr_groups,
> "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> DF_V3_6_MAX_COUNTERS);
You're resending this for other reasons, but don't forget to update the
indenting on the arguments so they still line up with the '('.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 10:43 ` Dan Carpenter
@ 2019-06-22 12:58 ` Mao Wenan
2019-06-22 13:06 ` Julia Lawall
2019-06-22 18:13 ` Joe Perches
2019-06-23 6:00 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Dan Carpenter
1 sibling, 2 replies; 29+ messages in thread
From: Mao Wenan @ 2019-06-22 12:58 UTC (permalink / raw)
To: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, julia.lawall
Cc: kernel-janitors, amd-gfx, linux-kernel, Mao Wenan
There is one warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
int ret = 0;
^
amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
which will use the return value. So it returns 'ret' for caller.
amdgpu_device_init()
r = amdgpu_pmu_init(adev);
Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
amdgpu_pmu_init().
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 0e6dba9..145e720 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
case CHIP_VEGA20:
/* init df */
ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
- "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
- DF_V3_6_MAX_COUNTERS);
+ "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
+ DF_V3_6_MAX_COUNTERS);
/* other pmu types go here*/
break;
@@ -261,7 +261,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
return 0;
}
- return 0;
+ return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 12:58 ` [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init Mao Wenan
@ 2019-06-22 13:06 ` Julia Lawall
2019-06-22 13:56 ` maowenan
2019-06-22 18:13 ` Joe Perches
1 sibling, 1 reply; 29+ messages in thread
From: Julia Lawall @ 2019-06-22 13:06 UTC (permalink / raw)
To: Mao Wenan
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, kernel-janitors, amd-gfx,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]
On Sat, 22 Jun 2019, Mao Wenan wrote:
> There is one warning:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> int ret = 0;
> ^
> amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
> which will use the return value. So it returns 'ret' for caller.
> amdgpu_device_init()
> r = amdgpu_pmu_init(adev);
>
> Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
>
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
> amdgpu_pmu_init().
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 0e6dba9..145e720 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> case CHIP_VEGA20:
> /* init df */
> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> - DF_V3_6_MAX_COUNTERS);
> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> + DF_V3_6_MAX_COUNTERS);
>
> /* other pmu types go here*/
I don't know what is the impact of the other pmu types that are planned
for the future. Perhaps it would be better to abort the function
immediately in the case of a failure.
julia
> break;
> @@ -261,7 +261,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> return 0;
> }
>
> - return 0;
> + return ret;
> }
>
>
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 13:06 ` Julia Lawall
@ 2019-06-22 13:56 ` maowenan
2019-06-22 14:00 ` Julia Lawall
0 siblings, 1 reply; 29+ messages in thread
From: maowenan @ 2019-06-22 13:56 UTC (permalink / raw)
To: Julia Lawall
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, kernel-janitors, amd-gfx,
linux-kernel
On 2019/6/22 21:06, Julia Lawall wrote:
>
>
> On Sat, 22 Jun 2019, Mao Wenan wrote:
>
>> There is one warning:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>> int ret = 0;
>> ^
>> amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
>> which will use the return value. So it returns 'ret' for caller.
>> amdgpu_device_init()
>> r = amdgpu_pmu_init(adev);
>>
>> Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
>>
>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>> ---
>> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
>> amdgpu_pmu_init().
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> index 0e6dba9..145e720 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>> case CHIP_VEGA20:
>> /* init df */
>> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>> - DF_V3_6_MAX_COUNTERS);
>> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>> + DF_V3_6_MAX_COUNTERS);
>>
>> /* other pmu types go here*/
>
> I don't know what is the impact of the other pmu types that are planned
> for the future. Perhaps it would be better to abort the function
> immediately in the case of a failure.
I guess it would be better to use new function or new switch case clause to process different PMU types
in future.
>
> julia
>
>> break;
>> @@ -261,7 +261,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>> return 0;
>> }
>>
>> - return 0;
>> + return ret;
>> }
>>
>>
>> --
>> 2.7.4
>>
>>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 13:56 ` maowenan
@ 2019-06-22 14:00 ` Julia Lawall
2019-06-24 3:16 ` maowenan
0 siblings, 1 reply; 29+ messages in thread
From: Julia Lawall @ 2019-06-22 14:00 UTC (permalink / raw)
To: maowenan
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, kernel-janitors, amd-gfx,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2459 bytes --]
On Sat, 22 Jun 2019, maowenan wrote:
>
>
> On 2019/6/22 21:06, Julia Lawall wrote:
> >
> >
> > On Sat, 22 Jun 2019, Mao Wenan wrote:
> >
> >> There is one warning:
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> >> int ret = 0;
> >> ^
> >> amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
> >> which will use the return value. So it returns 'ret' for caller.
> >> amdgpu_device_init()
> >> r = amdgpu_pmu_init(adev);
> >>
> >> Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
> >>
> >> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> >> ---
> >> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
> >> amdgpu_pmu_init().
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> >> index 0e6dba9..145e720 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> >> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> >> case CHIP_VEGA20:
> >> /* init df */
> >> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> >> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> >> - DF_V3_6_MAX_COUNTERS);
> >> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> >> + DF_V3_6_MAX_COUNTERS);
> >>
> >> /* other pmu types go here*/
> >
> > I don't know what is the impact of the other pmu types that are planned
> > for the future. Perhaps it would be better to abort the function
> > immediately in the case of a failure.
>
> I guess it would be better to use new function or new switch case clause to process different PMU types
> in future.
I don't know. But normally when an error may occur it is checked for
immediately, rather than just letting it go until the end of the function.
But maybe the developer know what is planned for the future for this
function.
julia
>
> >
> > julia
> >
> >> break;
> >> @@ -261,7 +261,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> >> return 0;
> >> }
> >>
> >> - return 0;
> >> + return ret;
> >> }
> >>
> >>
> >> --
> >> 2.7.4
> >>
> >>
> >
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 14:00 ` Julia Lawall
@ 2019-06-24 3:16 ` maowenan
0 siblings, 0 replies; 29+ messages in thread
From: maowenan @ 2019-06-24 3:16 UTC (permalink / raw)
To: Julia Lawall
Cc: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, kernel-janitors, amd-gfx,
linux-kernel
On 2019/6/22 22:00, Julia Lawall wrote:
>
>
> On Sat, 22 Jun 2019, maowenan wrote:
>
>>
>>
>> On 2019/6/22 21:06, Julia Lawall wrote:
>>>
>>>
>>> On Sat, 22 Jun 2019, Mao Wenan wrote:
>>>
>>>> There is one warning:
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>>>> int ret = 0;
>>>> ^
>>>> amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
>>>> which will use the return value. So it returns 'ret' for caller.
>>>> amdgpu_device_init()
>>>> r = amdgpu_pmu_init(adev);
>>>>
>>>> Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
>>>>
>>>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>>>> ---
>>>> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
>>>> amdgpu_pmu_init().
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>>>> index 0e6dba9..145e720 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>>>> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>>>> case CHIP_VEGA20:
>>>> /* init df */
>>>> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>>>> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>>>> - DF_V3_6_MAX_COUNTERS);
>>>> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>>>> + DF_V3_6_MAX_COUNTERS);
>>>>
>>>> /* other pmu types go here*/
>>>
>>> I don't know what is the impact of the other pmu types that are planned
>>> for the future. Perhaps it would be better to abort the function
>>> immediately in the case of a failure.
>>
OK, v3 will be sent.
>> I guess it would be better to use new function or new switch case clause to process different PMU types
>> in future.
>
> I don't know. But normally when an error may occur it is checked for
> immediately, rather than just letting it go until the end of the function.
> But maybe the developer know what is planned for the future for this
> function.
>
> julia
>
>>
>>>
>>> julia
>>>
>>>> break;
>>>> @@ -261,7 +261,7 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>>>> return 0;
>>>> }
>>>>
>>>> - return 0;
>>>> + return ret;
>>>> }
>>>>
>>>>
>>>> --
>>>> 2.7.4
>>>>
>>>>
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 12:58 ` [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init Mao Wenan
2019-06-22 13:06 ` Julia Lawall
@ 2019-06-22 18:13 ` Joe Perches
2019-06-24 3:41 ` maowenan
1 sibling, 1 reply; 29+ messages in thread
From: Joe Perches @ 2019-06-22 18:13 UTC (permalink / raw)
To: Mao Wenan, airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, julia.lawall
Cc: kernel-janitors, amd-gfx, linux-kernel, Jonathan Kim
On Sat, 2019-06-22 at 21:05 +0800, Mao Wenan wrote:
> There is one warning:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> int ret = 0;
[]
> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
> amdgpu_pmu_init().
[]
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
[]
> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> case CHIP_VEGA20:
> /* init df */
> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> - DF_V3_6_MAX_COUNTERS);
> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> + DF_V3_6_MAX_COUNTERS);
trivia:
The indentation change seems superfluous and
appears to make the code harder to read.
You could also cc Jonathan Kim who wrote all of this.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-22 18:13 ` Joe Perches
@ 2019-06-24 3:41 ` maowenan
2019-06-24 3:46 ` Joe Perches
0 siblings, 1 reply; 29+ messages in thread
From: maowenan @ 2019-06-24 3:41 UTC (permalink / raw)
To: Joe Perches, airlied, daniel, alexander.deucher,
christian.koenig, David1.Zhou, dan.carpenter, julia.lawall
Cc: kernel-janitors, amd-gfx, linux-kernel, Jonathan Kim
On 2019/6/23 2:13, Joe Perches wrote:
> On Sat, 2019-06-22 at 21:05 +0800, Mao Wenan wrote:
>> There is one warning:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
>> int ret = 0;
> []
>> v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
>> amdgpu_pmu_init().
> []
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> []
>> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>> case CHIP_VEGA20:
>> /* init df */
>> ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>> - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>> - DF_V3_6_MAX_COUNTERS);
>> + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>> + DF_V3_6_MAX_COUNTERS);
>
> trivia:
>
> The indentation change seems superfluous and
> appears to make the code harder to read.
>
> You could also cc Jonathan Kim who wrote all of this.
I think this is just display issue in mail format. It is correct that in vi/vim.
The arguments are line up with '(' after my change.
@@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)$
^Icase CHIP_VEGA20:$
^I^I/* init df */$
^I^Iret = init_pmu_by_type(adev, df_v3_6_attr_groups,$
-^I^I^I^I "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,$
-^I^I^I^I DF_V3_6_MAX_COUNTERS);$
+^I^I^I^I^I^I^I "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,$
+^I^I^I^I^I^I^I DF_V3_6_MAX_COUNTERS);$
$
^I^I/* other pmu types go here*/$
^I^Ibreak;$
>
>
>
> .
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init
2019-06-24 3:41 ` maowenan
@ 2019-06-24 3:46 ` Joe Perches
0 siblings, 0 replies; 29+ messages in thread
From: Joe Perches @ 2019-06-24 3:46 UTC (permalink / raw)
To: maowenan, airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, julia.lawall
Cc: kernel-janitors, amd-gfx, linux-kernel, Jonathan Kim
On Mon, 2019-06-24 at 11:41 +0800, maowenan wrote:
>
> On 2019/6/23 2:13, Joe Perches wrote:
> > On Sat, 2019-06-22 at 21:05 +0800, Mao Wenan wrote:
> > > There is one warning:
> > > drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
> > > drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
> > > int ret = 0;
> > []
> > > v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
> > > amdgpu_pmu_init().
> > []
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > []
> > > @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
> > > case CHIP_VEGA20:
> > > /* init df */
> > > ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> > > - "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> > > - DF_V3_6_MAX_COUNTERS);
> > > + "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> > > + DF_V3_6_MAX_COUNTERS);
> >
> > trivia:
> >
> > The indentation change seems superfluous and
> > appears to make the code harder to read.
> >
> > You could also cc Jonathan Kim who wrote all of this.
> I think this is just display issue in mail format. It is correct that in vi/vim.
> The arguments are line up with '(' after my change.
Use 8 character tabs and try again please.
> @@ -252,8 +252,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)$
> ^Icase CHIP_VEGA20:$
> ^I^I/* init df */$
> ^I^Iret = init_pmu_by_type(adev, df_v3_6_attr_groups,$
> -^I^I^I^I "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,$
> -^I^I^I^I DF_V3_6_MAX_COUNTERS);$
> +^I^I^I^I^I^I^I "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,$
> +^I^I^I^I^I^I^I DF_V3_6_MAX_COUNTERS);$
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2019-06-22 10:43 ` Dan Carpenter
2019-06-22 12:58 ` [PATCH -next v2] drm/amdgpu: return 'ret' in amdgpu_pmu_init Mao Wenan
@ 2019-06-23 6:00 ` Dan Carpenter
2019-06-23 6:10 ` Julia Lawall
1 sibling, 1 reply; 29+ messages in thread
From: Dan Carpenter @ 2019-06-23 6:00 UTC (permalink / raw)
To: Mao Wenan
Cc: David1.Zhou-5C7GfCeVMHo, airlied-cv59FeDIM0c,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, daniel-/w4YWyX8dFk,
alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo
On Sat, Jun 22, 2019 at 01:43:19PM +0300, Dan Carpenter wrote:
> On Sat, Jun 22, 2019 at 11:03:14AM +0800, Mao Wenan wrote:
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > index 0e6dba9..0bf4dd9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
> > /* init amdgpu_pmu */
> > int amdgpu_pmu_init(struct amdgpu_device *adev)
> > {
> > - int ret = 0;
> > -
> > switch (adev->asic_type) {
> > case CHIP_VEGA20:
> > /* init df */
> > - ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> > + init_pmu_by_type(adev, df_v3_6_attr_groups,
> > "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> > DF_V3_6_MAX_COUNTERS);
>
>
> You're resending this for other reasons, but don't forget to update the
> indenting on the arguments so they still line up with the '('.
>
Sorry, I was unclear. If you pull the init_pmu_by_type( back 6
characters then you also need to pull the "DF" back 6 characters.
init_pmu_by_type(adev, df_v3_6_attr_groups, "DF", "amdgpu_df",
PERF_TYPE_AMDGPU_DF, DF_V3_6_MAX_COUNTERS);
You can actually fit it into two lines afterwards.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variables 'ret'
2019-06-23 6:00 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Dan Carpenter
@ 2019-06-23 6:10 ` Julia Lawall
2019-06-24 3:45 ` [PATCH -next v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init Mao Wenan
0 siblings, 1 reply; 29+ messages in thread
From: Julia Lawall @ 2019-06-23 6:10 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mao Wenan, airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, kernel-janitors, amd-gfx, linux-kernel
On Sun, 23 Jun 2019, Dan Carpenter wrote:
> On Sat, Jun 22, 2019 at 01:43:19PM +0300, Dan Carpenter wrote:
> > On Sat, Jun 22, 2019 at 11:03:14AM +0800, Mao Wenan wrote:
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > > index 0e6dba9..0bf4dd9 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> > > @@ -246,12 +246,10 @@ static int init_pmu_by_type(struct amdgpu_device *adev,
> > > /* init amdgpu_pmu */
> > > int amdgpu_pmu_init(struct amdgpu_device *adev)
> > > {
> > > - int ret = 0;
> > > -
> > > switch (adev->asic_type) {
> > > case CHIP_VEGA20:
> > > /* init df */
> > > - ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
> > > + init_pmu_by_type(adev, df_v3_6_attr_groups,
> > > "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
> > > DF_V3_6_MAX_COUNTERS);
> >
> >
> > You're resending this for other reasons, but don't forget to update the
> > indenting on the arguments so they still line up with the '('.
> >
>
> Sorry, I was unclear. If you pull the init_pmu_by_type( back 6
> characters then you also need to pull the "DF" back 6 characters.
>
> init_pmu_by_type(adev, df_v3_6_attr_groups, "DF", "amdgpu_df",
> PERF_TYPE_AMDGPU_DF, DF_V3_6_MAX_COUNTERS);
>
> You can actually fit it into two lines afterwards.
My suggestion was to keep the ret = instead of discarding the indication
of failure, so I think that this is not relevant.
julia
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH -next v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
2019-06-23 6:10 ` Julia Lawall
@ 2019-06-24 3:45 ` Mao Wenan
[not found] ` <20190624034532.135201-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 29+ messages in thread
From: Mao Wenan @ 2019-06-24 3:45 UTC (permalink / raw)
To: airlied, daniel, alexander.deucher, christian.koenig,
David1.Zhou, dan.carpenter, julia.lawall
Cc: kernel-janitors, amd-gfx, linux-kernel, jonathan.kim, Mao Wenan
There is one warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c: In function ‘amdgpu_pmu_init’:
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:249:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
int ret = 0;
^
amdgpu_pmu_init() is called by amdgpu_device_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_device.c,
which will use the return value. So it should return 'ret' immediately if init_pmu_by_type() failed.
amdgpu_device_init()
r = amdgpu_pmu_init(adev);
This patch is also to update the indenting on the arguments so they line up with the '('.
Fixes: 9c7c85f7ea1f ("drm/amdgpu: add pmu counters")
Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
v1->v2: change the subject for this patch; change the indenting when it calls init_pmu_by_type; use the value 'ret' in
amdgpu_pmu_init().
v2->v3: change the subject for this patch; return 'ret' immediately if failed to call init_pmu_by_type().
drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 0e6dba9..b702322 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -252,8 +252,11 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
case CHIP_VEGA20:
/* init df */
ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
- "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
- DF_V3_6_MAX_COUNTERS);
+ "DF", "amdgpu_df",
+ PERF_TYPE_AMDGPU_DF,
+ DF_V3_6_MAX_COUNTERS);
+ if (ret)
+ return ret;
/* other pmu types go here*/
break;
--
2.7.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH -next] drm/amdgpu: remove set but not used variable 'adev'
2018-11-15 10:52 [PATCH -next] drm/amdgpu: remove set but not used variable 'ring' YueHaibing
` (2 preceding siblings ...)
2019-06-22 2:56 ` [PATCH -next] drm/amdgpu: remove set but not used variables 'ret' Mao Wenan
@ 2020-07-02 1:55 ` YueHaibing
2020-07-06 16:06 ` Alex Deucher
3 siblings, 1 reply; 29+ messages in thread
From: YueHaibing @ 2020-07-02 1:55 UTC (permalink / raw)
To: Alex Deucher, christian.koenig, airlied, daniel, sumit.semwal,
tianci.yin, kraxel, Likun.Gao, Felix.Kuehling, jgg,
Hawking.Zhang
Cc: YueHaibing, kernel-janitors, dri-devel, linaro-mm-sig, amd-gfx,
linux-media
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c: In function 'amdgpu_init_mem_type':
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:81:24: warning:
variable 'adev' set but not used [-Wunused-but-set-variable]
struct amdgpu_device *adev;
^
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index bb95627ad2cc..8199702d3354 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -78,10 +78,6 @@
static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
struct ttm_mem_type_manager *man)
{
- struct amdgpu_device *adev;
-
- adev = amdgpu_ttm_adev(bdev);
-
switch (type) {
case TTM_PL_SYSTEM:
/* System memory */
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH -next] drm/amdgpu: remove set but not used variable 'adev'
2020-07-02 1:55 ` [PATCH -next] drm/amdgpu: remove set but not used variable 'adev' YueHaibing
@ 2020-07-06 16:06 ` Alex Deucher
0 siblings, 0 replies; 29+ messages in thread
From: Alex Deucher @ 2020-07-06 16:06 UTC (permalink / raw)
To: YueHaibing
Cc: amd-gfx list, Dave Airlie, Kuehling, Felix, tiancyin,
kernel-janitors, Maling list - DRI developers, Sumit Semwal,
moderated list:DMA BUFFER SHARING FRAMEWORK, Jason Gunthorpe,
Gerd Hoffmann, Daniel Vetter, Alex Deucher, Likun Gao,
linux-media, Christian Koenig, Hawking Zhang
On Thu, Jul 2, 2020 at 3:25 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c: In function 'amdgpu_init_mem_type':
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:81:24: warning:
> variable 'adev' set but not used [-Wunused-but-set-variable]
> struct amdgpu_device *adev;
> ^
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
With our current -next tree, this patch is no longer applicable.
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index bb95627ad2cc..8199702d3354 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -78,10 +78,6 @@
> static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
> struct ttm_mem_type_manager *man)
> {
> - struct amdgpu_device *adev;
> -
> - adev = amdgpu_ttm_adev(bdev);
> -
> switch (type) {
> case TTM_PL_SYSTEM:
> /* System memory */
>
>
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 29+ messages in thread