åääïJoe Perches <joe@xxxxxxxxxxx>
åéææï2020-04-27 01:53:06
æääï"Christian KÃnig" <christian.koenig@xxxxxxx>,Bernard Zhao <bernard@xxxxxxxx>,Alex Deucher <alexander.deucher@xxxxxxx>,"David (ChunMing) Zhou" <David1.Zhou@xxxxxxx>,David Airlie <airlied@xxxxxxxx>,Daniel Vetter <daniel@xxxxxxxx>,amd-gfx@xxxxxxxxxxxxxxxxxxxxx,dri-devel@xxxxxxxxxxxxxxxxxxxxx,linux-kernel@xxxxxxxxxxxxxxx
æéäïopensource.kernel@xxxxxxxx
äéïRe: [PATCH] drm/radeon: cleanup coding style a bit>On Sun, 2020-04-26 at 15:18 +0200, Christian KÃnig wrote:
HiAm 26.04.20 um 15:12 schrieb Bernard Zhao:because this pattern is
Maybe no need to check ws before kmalloc, kmalloc will checkReviewed-by: Christian KÃnig <christian.koenig@xxxxxxx>
itself, kmalloc`s logic is if ptr is NULL, kmalloc will just
return
Signed-off-by: Bernard Zhao <bernard@xxxxxxxx>
I'm wondering why the automated scripts haven't found that one before.
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
I'm wondering if this removal is correct as the function@@ -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;
}
is named _locked and it may be recursive or called under
some external lock.
I am a little confused about this. I understand that the caller guarantees the lock protection
that we will not release the wrong pointer. And the NULL check is the same with the first check in kfree?
Maybe we do not need check twich.
Regards,
Bernard
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx