Commit 9d23e486 authored by Cristian Ciocaltea's avatar Cristian Ciocaltea Committed by Vinod Koul
Browse files

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: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
Fixes: 553be283 ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver")
Signed-off-by: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20241023-phy-sam-hdptx-rpm-fix-v1-1-87f4c994e346@collabora.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 2de679ec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1101,6 +1101,8 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
		return dev_err_probe(dev, PTR_ERR(hdptx->grf),
				     "Could not get GRF syscon\n");

	platform_set_drvdata(pdev, hdptx);

	ret = devm_pm_runtime_enable(dev);
	if (ret)
		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)
		return dev_err_probe(dev, PTR_ERR(hdptx->phy),
				     "Failed to create HDMI PHY\n");

	platform_set_drvdata(pdev, hdptx);
	phy_set_drvdata(hdptx->phy, hdptx);
	phy_set_bus_width(hdptx->phy, 8);