Skip to content

Commit c0b82ab

Browse files
Zijun Huvinodkoul
authored andcommitted
phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider
For devm_of_phy_provider_unregister(), its comment says it needs to invoke of_phy_provider_unregister() to unregister the phy provider, but it will not actually invoke the function since devres_destroy() does not call devm_phy_provider_release(), and the missing of_phy_provider_unregister() call will cause: - The phy provider fails to be unregistered. - Leak both memory and the OF node refcount. Fortunately, the faulty API has not been used by current kernel tree. Fix by using devres_release() instead of devres_destroy() within the API. Fixes: ff76496 ("drivers: phy: add generic PHY framework") Reviewed-by: Johan Hovold <[email protected]> Signed-off-by: Zijun Hu <[email protected]> Link: https://lore.kernel.org/stable/20241213-phy_core_fix-v6-2-40ae28f5015a%40quicinc.com Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent fe4bfa9 commit c0b82ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/phy/phy-core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,12 +1259,12 @@ EXPORT_SYMBOL_GPL(of_phy_provider_unregister);
12591259
* of_phy_provider_unregister to unregister the phy provider.
12601260
*/
12611261
void devm_of_phy_provider_unregister(struct device *dev,
1262-
struct phy_provider *phy_provider)
1262+
struct phy_provider *phy_provider)
12631263
{
12641264
int r;
12651265

1266-
r = devres_destroy(dev, devm_phy_provider_release, devm_phy_match,
1267-
phy_provider);
1266+
r = devres_release(dev, devm_phy_provider_release, devm_phy_match,
1267+
phy_provider);
12681268
dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n");
12691269
}
12701270
EXPORT_SYMBOL_GPL(devm_of_phy_provider_unregister);

0 commit comments

Comments
 (0)