[PATCH] phy: hisilicon: Fix OF node reference leak

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Feb 16 01:11:11 PST 2026


On Mon, Feb 16, 2026 at 11:09:59AM +0200, Andy Shevchenko wrote:
> On Mon, Feb 16, 2026 at 10:43:48AM +0200, Vladimir Oltean wrote:
> > On Wed, Nov 12, 2025 at 02:22:46PM +0800, Haotian Zhang wrote:

...

> >  	pcie_dev = bus_find_device_by_of_node(&platform_bus_type, pcie_port);
> > +	of_node_put(pcie_port);
> >  	if (!pcie_dev) {
> >  		dev_err(dev, "Didn't find pcie device\n");
> >  		return -ENODEV;
> >  	}
> > 
> > Note that there exists a second reference leak bug in the same function.
> > bus_find_device_by_of_node() requires put_device(pcie_dev)
> 
> Note, there is a pci_* wrapper for that.

Now I re-read this and found confusing comment, please, disregard this.

> > after it is no longer needed.
> 
> Is it only a local variable? If so, it's probably okay to put it, but that
> action needs more investigations of the how the pcie_dev is being used.
> Also, it might be (but I don't think it is) a (double) put_device() call
> somewhere else. TL;DR: the summary of this investigation should be present
> in the commit message.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-phy mailing list