kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amdgpu: remove set but not used variable 'ring'
@ 2018-11-15 10:52 YueHaibing
  2018-11-15 11:49 ` Huang, Ray
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: YueHaibing @ 2018-11-15 10:52 UTC (permalink / raw)
  To: Alex Deucher, christian.koenig, David1.Zhou, airlied,
	Shaoyun.Liu, David.Francis, ray.huang, Feifei.Xu, Likun.Gao
  Cc: YueHaibing, amd-gfx, dri-devel, linux-kernel, kernel-janitors

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)")

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 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	[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	[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	[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 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] 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

* 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 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

* [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	[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 v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
       [not found]           ` <20190624034532.135201-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2019-06-24  8:39             ` Dan Carpenter
  2019-06-24  9:29               ` maowenan
  0 siblings, 1 reply; 29+ messages in thread
From: Dan Carpenter @ 2019-06-24  8:39 UTC (permalink / raw)
  To: Mao Wenan
  Cc: David1.Zhou-5C7GfCeVMHo, jonathan.kim-5C7GfCeVMHo,
	airlied-cv59FeDIM0c, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	julia.lawall-L2FTfq7BK8M, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, christian.koenig-5C7GfCeVMHo

On Mon, Jun 24, 2019 at 11:45:32AM +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;
>       ^
> 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;

No no.  Sorry, the original indenting was correct and lined up with the
'(' character in 'init_pmu_by_type(', that's the way it should be.  If
we were to remove the "ret = " then we'd have to pull the arguments back
as well.  I think this fix that Julia suggested is really the right so
leave the indenting alone.

It looks like you've right aligned the arguments.  That's not the right
way, the original was correct.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH -next v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
  2019-06-24  8:39             ` Dan Carpenter
@ 2019-06-24  9:29               ` maowenan
       [not found]                 ` <4795ba5c-8e41-e1e0-c96a-47fdda3995e3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 29+ messages in thread
From: maowenan @ 2019-06-24  9:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: airlied, daniel, alexander.deucher, christian.koenig,
	David1.Zhou, julia.lawall, kernel-janitors, amd-gfx,
	linux-kernel, jonathan.kim, Joe Perches



On 2019/6/24 16:39, Dan Carpenter wrote:
> On Mon, Jun 24, 2019 at 11:45:32AM +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;
>>       ^
>> 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;
> 
> No no.  Sorry, the original indenting was correct and lined up with the
> '(' character in 'init_pmu_by_type(', that's the way it should be.  If
> we were to remove the "ret = " then we'd have to pull the arguments back
> as well.  I think this fix that Julia suggested is really the right so
> leave the indenting alone.
> 

> It looks like you've right aligned the arguments.  That's not the right
> way, the original was correct.
> 
After using 8 character for tab(thanks to Joe), the aligned here is wrong, yes, the original was correct.

so my v4 is only to change ret, don't change the indenting?

> regards,
> dan carpenter
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH -next v3] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
       [not found]                 ` <4795ba5c-8e41-e1e0-c96a-47fdda3995e3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2019-06-24  9:48                   ` Dan Carpenter
  2019-06-24 11:23                     ` [PATCH -next v4] " Mao Wenan
  0 siblings, 1 reply; 29+ messages in thread
From: Dan Carpenter @ 2019-06-24  9:48 UTC (permalink / raw)
  To: maowenan
  Cc: David1.Zhou-5C7GfCeVMHo, jonathan.kim-5C7GfCeVMHo,
	airlied-cv59FeDIM0c, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	julia.lawall-L2FTfq7BK8M, daniel-/w4YWyX8dFk,
	alexander.deucher-5C7GfCeVMHo, Joe Perches,
	christian.koenig-5C7GfCeVMHo

On Mon, Jun 24, 2019 at 05:29:33PM +0800, maowenan wrote:
> 
> 
> On 2019/6/24 16:39, Dan Carpenter wrote:
> > On Mon, Jun 24, 2019 at 11:45:32AM +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;
> >>       ^
> >> 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;
> > 
> > No no.  Sorry, the original indenting was correct and lined up with the
> > '(' character in 'init_pmu_by_type(', that's the way it should be.  If
> > we were to remove the "ret = " then we'd have to pull the arguments back
> > as well.  I think this fix that Julia suggested is really the right so
> > leave the indenting alone.
> > 
> 
> > It looks like you've right aligned the arguments.  That's not the right
> > way, the original was correct.
> > 
> After using 8 character for tab(thanks to Joe), the aligned here is wrong, yes, the original was correct.
> 
> so my v4 is only to change ret, don't change the indenting?
> 

Yes, please.  Sorry for my confusing email earlier.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
  2019-06-24  9:48                   ` Dan Carpenter
@ 2019-06-24 11:23                     ` Mao Wenan
       [not found]                       ` <20190624112318.149299-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 29+ messages in thread
From: Mao Wenan @ 2019-06-24 11:23 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);

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(). 
 v3->v4: delete the indenting for init_pmu_by_type() arguments. The original indenting is correct.

 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 0e6dba9f60f0..c98cf77a37f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -254,6 +254,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
 		ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
 				       "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
 				       DF_V3_6_MAX_COUNTERS);
+		if (ret)
+			return ret;
 
 		/* other pmu types go here*/
 		break;
-- 
2.20.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RE: [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
       [not found]                       ` <20190624112318.149299-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2019-06-24 17:42                         ` Kim, Jonathan
  2019-06-26 11:35                           ` maowenan
  0 siblings, 1 reply; 29+ messages in thread
From: Kim, Jonathan @ 2019-06-24 17:42 UTC (permalink / raw)
  To: Mao Wenan, airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk, Deucher,
	Alexander, Koenig, Christian, Zhou, David(ChunMing),
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA, julia.lawall-L2FTfq7BK8M
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

SW1tZWRpYXRlIHJldHVybiBzaG91bGQgYmUgb2sgc2luY2UgcGVyZiByZWdpc3RyYXRpb24gaXNu
J3QgZGVwZW5kZW50IG9uIGdwdSBody4NCg0KUmV2aWV3ZWQtYnk6IEpvbmF0aGFuIEtpbSA8Sm9u
YXRoYW4uS2ltQGFtZC5jb20+DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBN
YW8gV2VuYW4gPG1hb3dlbmFuQGh1YXdlaS5jb20+IA0KU2VudDogTW9uZGF5LCBKdW5lIDI0LCAy
MDE5IDc6MjMgQU0NClRvOiBhaXJsaWVkQGxpbnV4LmllOyBkYW5pZWxAZmZ3bGwuY2g7IERldWNo
ZXIsIEFsZXhhbmRlciA8QWxleGFuZGVyLkRldWNoZXJAYW1kLmNvbT47IEtvZW5pZywgQ2hyaXN0
aWFuIDxDaHJpc3RpYW4uS29lbmlnQGFtZC5jb20+OyBaaG91LCBEYXZpZChDaHVuTWluZykgPERh
dmlkMS5aaG91QGFtZC5jb20+OyBkYW4uY2FycGVudGVyQG9yYWNsZS5jb207IGp1bGlhLmxhd2Fs
bEBsaXA2LmZyDQpDYzoga2VybmVsLWphbml0b3JzQHZnZXIua2VybmVsLm9yZzsgYW1kLWdmeEBs
aXN0cy5mcmVlZGVza3RvcC5vcmc7IGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc7IEtpbSwg
Sm9uYXRoYW4gPEpvbmF0aGFuLktpbUBhbWQuY29tPjsgTWFvIFdlbmFuIDxtYW93ZW5hbkBodWF3
ZWkuY29tPg0KU3ViamVjdDogW1BBVENIIC1uZXh0IHY0XSBkcm0vYW1kZ3B1OiByZXR1cm4gJ3Jl
dCcgaW1tZWRpYXRlbHkgaWYgZmFpbGVkIGluIGFtZGdwdV9wbXVfaW5pdA0KDQpbQ0FVVElPTjog
RXh0ZXJuYWwgRW1haWxdDQoNClRoZXJlIGlzIG9uZSB3YXJuaW5nOg0KZHJpdmVycy9ncHUvZHJt
L2FtZC9hbWRncHUvYW1kZ3B1X3BtdS5jOiBJbiBmdW5jdGlvbiDigJhhbWRncHVfcG11X2luaXTi
gJk6DQpkcml2ZXJzL2dwdS9kcm0vYW1kL2FtZGdwdS9hbWRncHVfcG11LmM6MjQ5OjY6IHdhcm5p
bmc6IHZhcmlhYmxlIOKAmHJldOKAmSBzZXQgYnV0IG5vdCB1c2VkIFstV3VudXNlZC1idXQtc2V0
LXZhcmlhYmxlXQ0KICBpbnQgcmV0ID0gMDsNCiAgICAgIF4NCmFtZGdwdV9wbXVfaW5pdCgpIGlz
IGNhbGxlZCBieSBhbWRncHVfZGV2aWNlX2luaXQoKSBpbiBkcml2ZXJzL2dwdS9kcm0vYW1kL2Ft
ZGdwdS9hbWRncHVfZGV2aWNlLmMsDQp3aGljaCB3aWxsIHVzZSB0aGUgcmV0dXJuIHZhbHVlLiBT
byBpdCBzaG91bGQgcmV0dXJuICdyZXQnIGltbWVkaWF0ZWx5IGlmIGluaXRfcG11X2J5X3R5cGUo
KSBmYWlsZWQuDQphbWRncHVfZGV2aWNlX2luaXQoKQ0KICAgICAgICByID0gYW1kZ3B1X3BtdV9p
bml0KGFkZXYpOw0KDQpGaXhlczogOWM3Yzg1ZjdlYTFmICgiZHJtL2FtZGdwdTogYWRkIHBtdSBj
b3VudGVycyIpDQoNClNpZ25lZC1vZmYtYnk6IE1hbyBXZW5hbiA8bWFvd2VuYW5AaHVhd2VpLmNv
bT4NCi0tLQ0KIHYxLT52MjogY2hhbmdlIHRoZSBzdWJqZWN0IGZvciB0aGlzIHBhdGNoOyBjaGFu
Z2UgdGhlIGluZGVudGluZyB3aGVuIGl0IGNhbGxzIGluaXRfcG11X2J5X3R5cGU7IHVzZSB0aGUg
dmFsdWUgJ3JldCcgaW4gIGFtZGdwdV9wbXVfaW5pdCgpLg0KIHYyLT52MzogY2hhbmdlIHRoZSBz
dWJqZWN0IGZvciB0aGlzIHBhdGNoOyByZXR1cm4gJ3JldCcgaW1tZWRpYXRlbHkgaWYgZmFpbGVk
IHRvIGNhbGwgaW5pdF9wbXVfYnlfdHlwZSgpLg0KIHYzLT52NDogZGVsZXRlIHRoZSBpbmRlbnRp
bmcgZm9yIGluaXRfcG11X2J5X3R5cGUoKSBhcmd1bWVudHMuIFRoZSBvcmlnaW5hbCBpbmRlbnRp
bmcgaXMgY29ycmVjdC4NCg0KIGRyaXZlcnMvZ3B1L2RybS9hbWQvYW1kZ3B1L2FtZGdwdV9wbXUu
YyB8IDIgKysNCiAxIGZpbGUgY2hhbmdlZCwgMiBpbnNlcnRpb25zKCspDQoNCmRpZmYgLS1naXQg
YS9kcml2ZXJzL2dwdS9kcm0vYW1kL2FtZGdwdS9hbWRncHVfcG11LmMgYi9kcml2ZXJzL2dwdS9k
cm0vYW1kL2FtZGdwdS9hbWRncHVfcG11LmMNCmluZGV4IDBlNmRiYTlmNjBmMC4uYzk4Y2Y3N2Ez
N2YzIDEwMDY0NA0KLS0tIGEvZHJpdmVycy9ncHUvZHJtL2FtZC9hbWRncHUvYW1kZ3B1X3BtdS5j
DQorKysgYi9kcml2ZXJzL2dwdS9kcm0vYW1kL2FtZGdwdS9hbWRncHVfcG11LmMNCkBAIC0yNTQs
NiArMjU0LDggQEAgaW50IGFtZGdwdV9wbXVfaW5pdChzdHJ1Y3QgYW1kZ3B1X2RldmljZSAqYWRl
dikNCiAgICAgICAgICAgICAgICByZXQgPSBpbml0X3BtdV9ieV90eXBlKGFkZXYsIGRmX3YzXzZf
YXR0cl9ncm91cHMsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiREYi
LCAiYW1kZ3B1X2RmIiwgUEVSRl9UWVBFX0FNREdQVV9ERiwNCiAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIERGX1YzXzZfTUFYX0NPVU5URVJTKTsNCisgICAgICAgICAgICAg
ICBpZiAocmV0KQ0KKyAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJldDsNCg0KICAgICAg
ICAgICAgICAgIC8qIG90aGVyIHBtdSB0eXBlcyBnbyBoZXJlKi8NCiAgICAgICAgICAgICAgICBi
cmVhazsNCi0tDQoyLjIwLjENCg0K

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
  2019-06-24 17:42                         ` Kim, Jonathan
@ 2019-06-26 11:35                           ` maowenan
  2019-07-10  7:31                             ` maowenan
  0 siblings, 1 reply; 29+ messages in thread
From: maowenan @ 2019-06-26 11:35 UTC (permalink / raw)
  To: Kim, Jonathan, airlied, daniel, Deucher, Alexander, Koenig,
	Christian, Zhou, David(ChunMing),
	dan.carpenter, julia.lawall
  Cc: kernel-janitors, amd-gfx, linux-kernel



On 2019/6/25 1:42, Kim, Jonathan wrote:
> Immediate return should be ok since perf registration isn't dependent on gpu hw.
> 
> Reviewed-by: Jonathan Kim <Jonathan.Kim@amd.com>

thanks for review.

> 
> -----Original Message-----
> From: Mao Wenan <maowenan@huawei.com> 
> Sent: Monday, June 24, 2019 7:23 AM
> To: airlied@linux.ie; daniel@ffwll.ch; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; dan.carpenter@oracle.com; julia.lawall@lip6.fr
> Cc: kernel-janitors@vger.kernel.org; amd-gfx@lists.freedesktop.org; linux-kernel@vger.kernel.org; Kim, Jonathan <Jonathan.Kim@amd.com>; Mao Wenan <maowenan@huawei.com>
> Subject: [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
> 
> [CAUTION: External Email]
> 
> 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);
> 
> 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().
>  v3->v4: delete the indenting for init_pmu_by_type() arguments. The original indenting is correct.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 0e6dba9f60f0..c98cf77a37f3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -254,6 +254,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>                 ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>                                        "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>                                        DF_V3_6_MAX_COUNTERS);
> +               if (ret)
> +                       return ret;
> 
>                 /* other pmu types go here*/
>                 break;
> --
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
  2019-06-26 11:35                           ` maowenan
@ 2019-07-10  7:31                             ` maowenan
  0 siblings, 0 replies; 29+ messages in thread
From: maowenan @ 2019-07-10  7:31 UTC (permalink / raw)
  To: Kim, Jonathan, airlied, daniel, Deucher, Alexander, Koenig,
	Christian, Zhou, David(ChunMing),
	dan.carpenter, julia.lawall
  Cc: kernel-janitors, amd-gfx, linux-kernel


gentle ping


On 2019/6/26 19:35, maowenan wrote:
> 
> 
> On 2019/6/25 1:42, Kim, Jonathan wrote:
>> Immediate return should be ok since perf registration isn't dependent on gpu hw.
>>
>> Reviewed-by: Jonathan Kim <Jonathan.Kim@amd.com>
> 
> thanks for review.
> 
>>
>> -----Original Message-----
>> From: Mao Wenan <maowenan@huawei.com> 
>> Sent: Monday, June 24, 2019 7:23 AM
>> To: airlied@linux.ie; daniel@ffwll.ch; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; dan.carpenter@oracle.com; julia.lawall@lip6.fr
>> Cc: kernel-janitors@vger.kernel.org; amd-gfx@lists.freedesktop.org; linux-kernel@vger.kernel.org; Kim, Jonathan <Jonathan.Kim@amd.com>; Mao Wenan <maowenan@huawei.com>
>> Subject: [PATCH -next v4] drm/amdgpu: return 'ret' immediately if failed in amdgpu_pmu_init
>>
>> [CAUTION: External Email]
>>
>> 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);
>>
>> 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().
>>  v3->v4: delete the indenting for init_pmu_by_type() arguments. The original indenting is correct.
>>
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> index 0e6dba9f60f0..c98cf77a37f3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
>> @@ -254,6 +254,8 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
>>                 ret = init_pmu_by_type(adev, df_v3_6_attr_groups,
>>                                        "DF", "amdgpu_df", PERF_TYPE_AMDGPU_DF,
>>                                        DF_V3_6_MAX_COUNTERS);
>> +               if (ret)
>> +                       return ret;
>>
>>                 /* other pmu types go here*/
>>                 break;
>> --
>> 2.20.1
>>
> 
> 
> .
> 

^ permalink raw reply	[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	[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

end of thread, other threads:[~2020-07-06 16:06 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2019-06-22  6:02   ` Julia Lawall
2019-06-22  7:20     ` maowenan
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-22 13:06       ` Julia Lawall
2019-06-22 13:56         ` maowenan
2019-06-22 14:00           ` Julia Lawall
2019-06-24  3:16             ` maowenan
2019-06-22 18:13       ` Joe Perches
2019-06-24  3:41         ` maowenan
2019-06-24  3:46           ` Joe Perches
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
     [not found]           ` <20190624034532.135201-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2019-06-24  8:39             ` Dan Carpenter
2019-06-24  9:29               ` maowenan
     [not found]                 ` <4795ba5c-8e41-e1e0-c96a-47fdda3995e3-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2019-06-24  9:48                   ` Dan Carpenter
2019-06-24 11:23                     ` [PATCH -next v4] " Mao Wenan
     [not found]                       ` <20190624112318.149299-1-maowenan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2019-06-24 17:42                         ` Kim, Jonathan
2019-06-26 11:35                           ` maowenan
2019-07-10  7:31                             ` maowenan
2020-07-02  1:55 ` [PATCH -next] drm/amdgpu: remove set but not used variable 'adev' YueHaibing
2020-07-06 16:06   ` 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).