Re: [PATCH next] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()
From: Dan Carpenter
Date: Sat Apr 12 2025 - 10:29:02 EST
On Thu, Apr 10, 2025 at 10:29:31PM +0530, Yadav, Arvind wrote:
> Please change this also instead of 'goto free_fence_drv' just return err.
>
> fence_drv = kzalloc(sizeof(*fence_drv), GFP_KERNEL);
> if (!fence_drv) {
> DRM_ERROR("Failed to allocate memory for fence driver\n");
> r = -ENOMEM;
> goto free_fence_drv; // this should be replace by return.
> }
>
> ~arvind
I noticed that when I was writing my patch as well. I'm always in favor
of direct returns, but it makes the patch confusing to add this unrelated
cleanup... I'll send it as a separate patch.
regards,
dan carpenter