[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_P9C71cc0Ua7cSYwkTPgY_YDXBOw-==XtXQCH+rxgW9Fw@mail.gmail.com>
Date: Fri, 21 May 2021 17:00:24 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Felix Kuehling <Felix.Kuehling@....com>,
David Airlie <airlied@...ux.ie>,
LKML <linux-kernel@...r.kernel.org>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>
Subject: Re: [PATCH] drm/amd/amdkfd: Drop unnecessary NULL check after container_of
Applied. Thanks!
Alex
On Fri, May 21, 2021 at 11:02 AM Guenter Roeck <linux@...ck-us.net> wrote:
>
> 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
> ...+>
>
> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 5b6c5669c03d..2f8d352e0069 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -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)
> --
> 2.25.1
>
Powered by blists - more mailing lists