mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Bernard Zhao" <bernard@vivo.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Jingwen Chen" <Jingwen.Chen2@amd.com>,
	"Candice Li" <candice.li@amd.com>,
	"John Clements" <john.clements@amd.com>,
	"Monk liu" <monk.liu@amd.com>,
	"Peng Ju Zhou" <PengJu.Zhou@amd.com>,
	"Jiawei Gu" <Jiawei.Gu@amd.com>,
	"Bokun Zhang" <bokun.zhang@amd.com>,
	"Zhigang Luo" <zhigang.luo@amd.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amd/amdgpu: cleanup the code style a bit
Date: Mon, 15 Nov 2021 12:49:02 +0100	[thread overview]
Message-ID: <ebcf8b30-7311-9d77-07ab-1b92756c0ae0@gmail.com> (raw)
In-Reply-To: <20211115070714.7007-1-bernard@vivo.com>

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.

Christian.

>
> Signed-off-by: Bernard Zhao <bernard@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;
>   	}
>   


  reply	other threads:[~2021-11-15 11:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  7:07 Bernard Zhao
2021-11-15 11:49 ` Christian König [this message]
     [not found] ` <AFkAWADGE4YQkIdpTO49K4pP.9.1636976948000.Hmail.bernard@vivo.com.@PGViY2Y4YjMwLTczMTEtOWQ3Ny0wN2FiLTFiOTI3NTZjMGFlMEBnbWFpbC5jb20+>
2021-11-15 12:01   ` 答复: " 赵军奎

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ebcf8b30-7311-9d77-07ab-1b92756c0ae0@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Jiawei.Gu@amd.com \
    --cc=Jingwen.Chen2@amd.com \
    --cc=PengJu.Zhou@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bernard@vivo.com \
    --cc=bokun.zhang@amd.com \
    --cc=candice.li@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john.clements@amd.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monk.liu@amd.com \
    --cc=zhigang.luo@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®