答复: [PATCH] drm/amd/amdgpu: cleanup the code style a bit
赵军奎
bernard at vivo.com
Mon Nov 15 12:01:48 UTC 2021
-----邮件原件-----
发件人: bernard at vivo.com <bernard at vivo.com> 代表 Christian K?nig
发送时间: 2021年11月15日 19:49
收件人: 赵军奎 <bernard at vivo.com>; Alex Deucher <alexander.deucher at amd.com>; Christian König <christian.koenig at amd.com>; Pan, Xinhui <Xinhui.Pan at amd.com>; David Airlie <airlied at linux.ie>; Daniel Vetter <daniel at ffwll.ch>; Jingwen Chen <Jingwen.Chen2 at amd.com>; Candice Li <candice.li at amd.com>; John Clements <john.clements at amd.com>; Monk liu <monk.liu at amd.com>; Peng Ju Zhou <PengJu.Zhou at amd.com>; Jiawei Gu <Jiawei.Gu at amd.com>; Bokun Zhang <bokun.zhang at amd.com>; Zhigang Luo <zhigang.luo at amd.com>; Lee Jones <lee.jones at linaro.org>; amd-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org; linux-kernel at vger.kernel.org
主题: Re: [PATCH] drm/amd/amdgpu: cleanup the code style a bit
Am 15.11.21 um 08:07 schrieb Bernard Zhao:
> This change is to cleanup the code style a bit.
>To be honest I think the old style looked better. It took me a moment to validate this now.
>What you could to instead is to have goto style error handling which would make this a bit more cleaner I think.
Hi
Looks like a good idea, thank you for your comments!
I will resubmit a version!
BR//Bernard
>Christian.
>
> Signed-off-by: Bernard Zhao <bernard at vivo.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 04cf9b207e62..90070b41136a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -286,12 +286,14 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev)
> return -ENOMEM;
>
> bps = kmalloc_array(align_space, sizeof((*data)->bps), GFP_KERNEL);
> + if (!bps) {
> + kfree(*data);
> + return -ENOMEM;
> + }
> bps_bo = kmalloc_array(align_space, sizeof((*data)->bps_bo),
> GFP_KERNEL);
> -
> - if (!bps || !bps_bo) {
> - kfree(bps);
> - kfree(bps_bo);
> + if (!bps_bo) {
> kfree(*data);
> + kfree(bps);
> return -ENOMEM;
> }
>
More information about the amd-gfx
mailing list