mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 21:47:41 +04:00
pcs_enable() enables a channel's RX clock and then its TX clock, and returns as soon as one of them fails - leaving the other one enabled. Nothing rebalances that: the next call enables the survivor a second time, and the pair never lines up again. pcs_disable() has the mirror shape without the checks. The two are adjacent entries of the bulk array the driver already holds, so clk_bulk_enable() takes them in one call and unwinds what it enabled when one fails - the property the open-coded pair is missing. That leaves the other half of the same imbalance: phylink discards what pcs_enable() returns and calls pcs_disable() either way, so a channel whose clocks would not enable still gets a reference dropped that was never taken, underflowing the enable count. Record per channel whether the driver left the pair on, and disable only what it enabled. Not exercised on hardware: both call sites are IPQ5018-only and the board here is an IPQ8074, where the driver leaves the port clocks to the configuration sequence. Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de> Link: https://github.com/openwrt/openwrt/pull/24186 Signed-off-by: Robert Marko <robimarko@gmail.com>