From f8780b598cda9ba3dc99e9e33573ae718b20c360 Mon Sep 17 00:00:00 2001 From: Ram Kumar Dwivedi Date: Tue, 20 Aug 2024 12:10:58 +0530 Subject: [PATCH] ufs: phy: Defer phy_init if phy is not probed From ufs_qcom_init, we call phy_init() to initialize phy driver for ufs. But sometimes, the phy driver haven't got probed yet when we call phy_init. This causes kernel panic during phy_init_clks. So, before proceeding for phy clock initialization, first check if the phy handle is available or not. Defer the probe if it is not available. Change-Id: Iadbc4f10719de2a1150fa00a9b5ec125db429464 Signed-off-by: Ram Kumar Dwivedi --- drivers/phy/qualcomm/phy-qcom-ufs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c index 431e777a6bfd..335973970775 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c @@ -240,6 +240,12 @@ int ufs_qcom_phy_init_clks(struct ufs_qcom_phy *phy_common) { int err; + if (!phy_common) { + pr_err("%s: Defering the probe: Failed to get the required phy handle!!\n", + __func__); + return -EPROBE_DEFER; + } + if (of_device_is_compatible(phy_common->dev->of_node, "qcom,msm8996-ufs-phy-qmp-14nm")) goto skip_txrx_clk;