[PATCH 01/12] drm/amdgpu: add missing error handling

Huang, Ray Ray.Huang at amd.com
Fri Sep 28 07:36:03 UTC 2018


> -----Original Message-----
> From: Christian König [mailto:ckoenig.leichtzumerken at gmail.com]
> Sent: Thursday, September 27, 2018 7:26 PM
> To: Huang, Ray <Ray.Huang at amd.com>
> Cc: amd-gfx at lists.freedesktop.org
> Subject: Re: [PATCH 01/12] drm/amdgpu: add missing error handling
> 
> Am 27.09.2018 um 12:00 schrieb Huang Rui:
> > On Wed, Sep 26, 2018 at 03:53:19PM +0200, Christian König wrote:
> >> We ignored the return code here.
> >>
> >> Signed-off-by: Christian König <christian.koenig at amd.com>
> >> ---
> >>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> >> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> >> index f35d7a554ad5..2420ae90047e 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> >> @@ -959,6 +959,9 @@ static int gmc_v9_0_sw_init(void *handle)
> >>   	/* This interrupt is VMC page fault.*/
> >>   	r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_VMC,
> VMC_1_0__SRCID__VM_FAULT,
> >>   				&adev->gmc.vm_fault);
> >> +	if (r)
> >> +		return r;
> >> +
> >>   	r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_UTCL2,
> UTCL2_1_0__SRCID__FAULT,
> >>   				&adev->gmc.vm_fault);
> >>
> > We should tear down the client source that allocated by the
> > SOC15_IH_CLIENTID_VMC (the last one) if it (the second one) gets failed.
> 
> There is no such thing as a teardown. amdgpu_irq_add_id() registers the irq
> callback for the clientid/srcid combination, but there isn't an unregister
> function.

Actually, I see we will allocate the sources that register at the specific client.

adev->irq.client[client_id].sources = kcalloc(AMDGPU_MAX_IRQ_SRC_ID, sizeof(struct amdgpu_irq_src *), GFP_KERNEL);

While CLIENTID_UTCL2 add_id get failed, need we free the sources that allocated by CLIENTID_VMC? Otherwise, it looks a minor memory leak here for me.

Thanks,
Ray

> 
> Christian.
> 
> >
> > Thanks,
> > Ray
> >
> >> --
> >> 2.14.1
> >>
> >> _______________________________________________
> >> amd-gfx mailing list
> >> amd-gfx at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx



More information about the amd-gfx mailing list