Re: [PATCH] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device

From: Miaoqian Lin
Date: Wed Jan 12 2022 - 06:54:46 EST


Hi Suman,

On Mon, Jan 10, 2022 at 12:43:57PM -0600, Suman Anna wrote:
> Hi Miaoqian,
>
> On 1/9/22 8:43 PM, Miaoqian Lin wrote:
> > Hi Suman Anna,
> > On Fri, Jan 07, 2022 at 08:42:16AM -0600, Suman Anna wrote:
> >> Hi Miaoqian,
> >>
> >>
> >>> Add the corresponding 'put_device()' in the error handling paths.
> >>
> >> Also, need it in the regular path, not just in error handling path.
> > I think after calling platform_get_drvdata() normally, the
> > reference will be released in other functions, so don't need it in the
> > regular path.
> >
>
> No, it's a local reference and is acquired within omap_iommu_probe_device() and
> needs to be released within this function. What other function are you referring
> to here?
>

I am referring to the release function of this device, here is
omap_iommu_release_device(). But I find omap_iommu_release_device()
doesn't handle the reference, and calls kfree(arch_data) directly.