2022-04-22 19:33:29

by baihaowen

[permalink] [raw]
Subject: [PATCH] drm/amdgpu: Remove useless kfree

After alloc fail, we do not need to kfree.

Signed-off-by: Haowen Bai <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index ec709997c9c7..5fb3e69c04c4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1849,7 +1849,6 @@ static int amdgpu_ras_realloc_eh_data_space(struct amdgpu_device *adev,
void *bps = kmalloc(align_space * sizeof(*data->bps), GFP_KERNEL);

if (!bps) {
- kfree(bps);
return -ENOMEM;
}

--
2.7.4


2022-04-22 22:29:06

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/amdgpu: Remove useless kfree

Applied. Thanks!

Alex

On Fri, Apr 22, 2022 at 2:04 AM Haowen Bai <[email protected]> wrote:
>
> After alloc fail, we do not need to kfree.
>
> Signed-off-by: Haowen Bai <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index ec709997c9c7..5fb3e69c04c4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1849,7 +1849,6 @@ static int amdgpu_ras_realloc_eh_data_space(struct amdgpu_device *adev,
> void *bps = kmalloc(align_space * sizeof(*data->bps), GFP_KERNEL);
>
> if (!bps) {
> - kfree(bps);
> return -ENOMEM;
> }
>
> --
> 2.7.4
>