lkml.org 
[lkml]   [2020]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] drm/radeon: cleanup coding style a bit
From
Date
On Sun, 2020-04-26 at 15:18 +0200, Christian König wrote:
> Am 26.04.20 um 15:12 schrieb Bernard Zhao:
> > Maybe no need to check ws before kmalloc, kmalloc will check
> > itself, kmalloc`s logic is if ptr is NULL, kmalloc will just
> > return
> >
> > Signed-off-by: Bernard Zhao <bernard@vivo.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> I'm wondering why the automated scripts haven't found that one before.

because this pattern is

if (foo)
kfree(bar);

and the pattern looked for is:

if (foo)
kfree(foo);

> > diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
[]
> > @@ -1211,8 +1211,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
> > SDEBUG("<<\n");
> >
> > free:
> > - if (ws)
> > - kfree(ectx.ws);
> > + kfree(ectx.ws);
> > return ret;
> > }

I'm wondering if this removal is correct as the function
is named _locked and it may be recursive or called under
some external lock.


\
 
 \ /
  Last update: 2020-04-26 19:53    [W:0.070 / U:3.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site