Skip to contentSkip to conversation

fix warning for condition check

PATCH In review Sunil Khatri 2 participants 7 messages Aug 7, 2024 – Aug 8, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover fix warning for condition check

*** BLURB HERE ***

Sunil Khatri (5):
drm/amdgpu: fix ptr check warning in gfx9 ip_dump drm/amdgpu: fix ptr check warning in gfx10 ip_dump drm/amdgpu: fix ptr check warning in gfx11 ip_dump drm/amdgpu: fix ptr check warning in gfx12 ip_dump drm/amdgpu: fix ptr check warning in vcn_v3 ip_dump

 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c  | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/5 drm/amdgpu: fix ptr check warning in gfx9 ip_dump

Change if (ptr == NULL) to if (!ptr) for a better
format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 991f7c2fc1a2..ab10a05c7885 100644
@@ -2129,7 +2129,7 @@ static void gfx_v9_0_alloc_ip_dump(struct amdgpu_device *adev)
 	uint32_t inst;
 
 	ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX IP Dump\n");
 		adev->gfx.ip_dump_core = NULL;
 	} else {
@@ -2142,7 +2142,7 @@ static void gfx_v9_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.mec.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n");
 		adev->gfx.ip_dump_compute_queues = NULL;
 	} else {
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/5 drm/amdgpu: fix ptr check warning in gfx10 ip_dump

In reply to Sunil Khatri

Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3 -3
index 1b88528b512b..75a6ca645964 100644
@@ -4648,7 +4648,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev)
 	uint32_t inst;
 
 	ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX IP Dump\n");
 		adev->gfx.ip_dump_core = NULL;
 	} else {
@@ -4661,7 +4661,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.mec.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n");
 		adev->gfx.ip_dump_compute_queues = NULL;
 	} else {
@@ -4674,7 +4674,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.me.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n");
 		adev->gfx.ip_dump_gfx_queues = NULL;
 	} else {
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/5 drm/amdgpu: fix ptr check warning in gfx11 ip_dump

In reply to Sunil Khatri

Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +3 -3
index e7c160b9d0fe..22bb35278691 100644
@@ -1502,7 +1502,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev)
 	uint32_t inst;
 
 	ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX IP Dump\n");
 		adev->gfx.ip_dump_core = NULL;
 	} else {
@@ -1515,7 +1515,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.mec.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n");
 		adev->gfx.ip_dump_compute_queues = NULL;
 	} else {
@@ -1528,7 +1528,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.me.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n");
 		adev->gfx.ip_dump_gfx_queues = NULL;
 	} else {
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/5 drm/amdgpu: fix ptr check warning in gfx12 ip_dump

In reply to Sunil Khatri

Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
index 0a71e216a7f5..df72fa125fd2 100644
@@ -1281,7 +1281,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
 	uint32_t inst;
 
 	ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX IP Dump\n");
 		adev->gfx.ip_dump_core = NULL;
 	} else {
@@ -1294,7 +1294,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.mec.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n");
 		adev->gfx.ip_dump_compute_queues = NULL;
 	} else {
@@ -1307,7 +1307,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev)
 		adev->gfx.me.num_queue_per_pipe;
 
 	ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n");
 		adev->gfx.ip_dump_gfx_queues = NULL;
 	} else {
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/5 drm/amdgpu: fix ptr check warning in vcn_v3 ip_dump

In reply to Sunil Khatri

Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +1 -1
index c2278cc49dd5..6d74da7b7ffb 100644
@@ -359,7 +359,7 @@ static int vcn_v3_0_sw_init(void *handle)
 
 	/* Allocate memory for VCN IP Dump buffer */
 	ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL);
-	if (ptr == NULL) {
+	if (!ptr) {
 		DRM_ERROR("Failed to allocate memory for VCN IP Dump\n");
 		adev->vcn.ip_dump = NULL;
 	} else {
Signature · 1 line
2.34.1
Reviewed-by on v1 5/5
#6 lore raw

Re: [PATCH v1 5/5] drm/amdgpu: fix ptr check warning in vcn_v3 ip_dump

Series is:

Quoted 25 lines · Sunil Khatri

Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +1 -2
index c2278cc49dd5..6d74da7b7ffb 100644
@@ -359,7 +359,7 @@ static int vcn_v3_0_sw_init(void *handle)
 
        /* Allocate memory for VCN IP Dump buffer */
        ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL);
-       if (ptr == NULL) {
+       if (!ptr) {
                DRM_ERROR("Failed to allocate memory for VCN IP Dump\n");
                adev->vcn.ip_dump = NULL;
        } else {
--

2.34.1