net: stmmac: don't put an absent MDIO reset GPIO - #524
Conversation
devm_gpiod_get_optional() returns NULL when the property is absent, and both call sites only test IS_ERR() before calling devm_gpiod_put(). With no "snps,reset" in the device tree that puts NULL, devres_release() finds nothing to release, and WARN_ON fires on every probe: WARNING: CPU: 1 PID: 1 at drivers/gpio/gpiolib-devres.c:327 devm_gpiod_put+0x34/0x44 Call trace: devm_gpiod_put+0x34/0x44 stmmac_mdio_reset+0x110/0x150 __mdiobus_register+0x228/0x298 Boards whose PHY needs no reset line hit this every boot — the RK3528 TV boxes use an integrated FEPHY and never set the property. Signed-off-by: Artem Butusov <art.sormy@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe STMMAC MDIO driver now checks whether the optional reset GPIO descriptor exists before releasing it in Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized change safely avoids releasing an absent MDIO reset GPIO descriptor; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
devm_gpiod_get_optional()returns NULL when the property is absent, but both callsites only test
IS_ERR()beforedevm_gpiod_put(). Putting NULL meansdevres_release()finds nothing, returns-ENOENT, and theWARN_ONinsidedevm_gpiod_put()fires on every probe:Only three device trees in this repo set
snps,reset, so most Rockchip boards withan integrated PHY take the NULL path.
gpiod_set_value_cansleep()already toleratesNULL, so only the two puts need guarding.
Verified on an RK3528 board: MDIO registers (
stmmac-0:02),end0comes up, warninggone.