drm/amdgpu: fix ptr check warning in gfx12 ip_dump
authorSunil Khatri <sunil.khatri@amd.com>
Wed, 7 Aug 2024 11:58:02 +0000 (17:28 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 14:34:51 +0000 (10:34 -0400)
Change condition, if (ptr == NULL) to if (!ptr)
for a better format and fix the warning.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c

index 0a71e216a7f540727c7251440db17b1b8f5568ca..df72fa125fd275a2e387effd0afa8317564d9740 100644 (file)
@@ -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 {