Skip to content

Commit 9d23e48

Browse files
cristiccvinodkoul
authored andcommitted
phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
In some cases, rk_hdptx_phy_runtime_resume() may be invoked before platform_set_drvdata() is executed in ->probe(), leading to a NULL pointer dereference when using the return of dev_get_drvdata(). Ensure platform_set_drvdata() is called before devm_pm_runtime_enable(). Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Fixes: 553be28 ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20241023-phy-sam-hdptx-rpm-fix-v1-1-87f4c994e346@collabora.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 2de679e commit 9d23e48

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,8 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
11011101
return dev_err_probe(dev, PTR_ERR(hdptx->grf),
11021102
"Could not get GRF syscon\n");
11031103

1104+
platform_set_drvdata(pdev, hdptx);
1105+
11041106
ret = devm_pm_runtime_enable(dev);
11051107
if (ret)
11061108
return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
@@ -1110,7 +1112,6 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
11101112
return dev_err_probe(dev, PTR_ERR(hdptx->phy),
11111113
"Failed to create HDMI PHY\n");
11121114

1113-
platform_set_drvdata(pdev, hdptx);
11141115
phy_set_drvdata(hdptx->phy, hdptx);
11151116
phy_set_bus_width(hdptx->phy, 8);
11161117

0 commit comments

Comments
 (0)