drm/amd/amdkfd: Drop unnecessary NULL check after container_of
authorGuenter Roeck <linux@roeck-us.net>
Fri, 21 May 2021 15:02:12 +0000 (08:02 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 21 May 2021 22:18:04 +0000 (18:18 -0400)
The first parameter passed to container_of() is the pointer to the work
structure passed to the worker and never NULL. The NULL check on the
result of container_of() is therefore unnecessary and misleading.
Remove it.

This change was made automatically with the following Coccinelle script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 5b6c5669c03de7f6807562df8599365017772027..2f8d352e006905fb0681884e846f1d97b480a60f 100644 (file)
@@ -110,8 +110,6 @@ static void kfd_sdma_activity_worker(struct work_struct *work)
 
        workarea = container_of(work, struct kfd_sdma_activity_handler_workarea,
                                sdma_activity_work);
-       if (!workarea)
-               return;
 
        pdd = workarea->pdd;
        if (!pdd)