[PATCH] phy: usb: Fix USB 2.0 clock reference leak in brcm_usb_phy_dvr_init()

Manivannan Sadhasivam mani at kernel.org
Mon Oct 12 09:02:59 PDT 2026


On Mon, Oct 12, 2026 at 09:27:07PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Sep 17, 2026 at 01:35:10PM +0000, Wentao Liang wrote:
> > brcm_usb_phy_dvr_init() obtains usb_20_clk with of_clk_get_by_name(),
> > which takes a reference on the clock, but several later error returns
> > -- a failed clk_prepare_enable(), a failed devm_phy_create(), the
> > -EPROBE_DEFER paths of usb_30_clk and suspend_clk, and a failed
> > devm_request_irq() -- return without calling clk_put().  No other code
> > in the driver releases it either.
> > 
> > Add an err_put_clks label that drops the reference before returning.
> > 
> > Fixes: 49859e55e364 ("phy: usb: phy-brcm-usb: Add Broadcom STB USB phy driver")
> > Cc: stable at vger.kernel.org
> > Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
> 
> Duplicate of https://lore.kernel.org/linux-phy/20260913012956.16443-1-mhun512@gmail.com
> 

Sorry my bad. That patch was handling clk_prepare_enable() leak. But there is no
point in different patches doing these things. Just handle all clk leaks in
probe in a single patch.

- Mani

-- 
மணிவண்ணன் சதாசிவம்



More information about the linux-phy mailing list