[PATCH v2 RESEND] coresight: etm-perf: Fix reference count leak in etm_setup_aux
Leo Yan
leo.yan at arm.com
Fri Dec 19 04:17:54 PST 2025
On Fri, Dec 19, 2025 at 11:48:35AM +0000, Suzuki K Poulose wrote:
[...]
> > My understanding is we don't grab a device from
> > coresight_find_device_by_fwnode(). The callers only check whether the
> > device is present on the bus; if it isn't, the driver defers probe.
> >
> > This is similiar to coresight_find_csdev_by_fwnode(), which calls
> > put_device(dev) to release refcnt immediately. This is why I
> > suggested the change, so the two functions behave consistently.
> >
>
> I see, sorry. I saw some other uses of the device, but clearly I was wrong.
> May be we should simply re-structure the function to :
No worries and thanks for confirmation.
> bool coresight_fwnode_device_present(fwnode)
> {
>
> // find and drop the ref if required.
> return true/false;
> }
>
> The name "find_device_by_fwnode" and returning a freed reference doesn't
> look good to me.
Renaming is good. Maybe use a separate patch to rename:
coresight_find_csdev_by_fwnode() -> coresight_fwnode_csdev_present()
Thanks,
Leo
More information about the linux-arm-kernel
mailing list