Skip to contentSkip to conversation

phy: qcom: edp: Fix NULL pointer dereference for phy v6 (x1e80100)

PATCH Superseded Val Packett 4 participants 4 messages Jan 9 – Jan 13

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: qcom: edp: Fix NULL pointer dereference for phy v6 (x1e80100)

For Glymur SoC support, the com_clk_fwd_cfg callback was added, and a stub implementation was added for the v4 of the hardware. However it was omitted for the v6, causing a NULL pointer dereference oops on Hamoa/Purwa (X1E/X1P) SoC devices. Fix by adding the appropriate stub.

Fixes add66a6673bc ("phy: qcom: edp: Add Glymur platform support")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/phy/qualcomm/phy-qcom-edp.c +6 -0
index 13feab99feec..a17492db21d8 100644
@@ -613,6 +613,11 @@ static int qcom_edp_phy_com_resetsm_cntrl_v6(const struct qcom_edp *edp)
 				     val, val & BIT(0), 500, 10000);
 }
 
+static int qcom_edp_com_clk_fwd_cfg_v6(const struct qcom_edp *edp)
+{
+	return 0;
+}
+
 static int qcom_edp_com_bias_en_clkbuflr_v6(const struct qcom_edp *edp)
 {
 	/* Turn on BIAS current for PHY/PLL */
@@ -758,6 +763,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 	.com_power_on		= qcom_edp_phy_power_on_v6,
 	.com_resetsm_cntrl	= qcom_edp_phy_com_resetsm_cntrl_v6,
 	.com_bias_en_clkbuflr	= qcom_edp_com_bias_en_clkbuflr_v6,
+	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_v6,
 	.com_configure_pll	= qcom_edp_com_configure_pll_v6,
 	.com_configure_ssc	= qcom_edp_com_configure_ssc_v6,
 };
Signature · 1 line
2.51.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Val Packett

For Glymur SoC support, the com_clk_fwd_cfg callback was added, and a stub implementation was added for the v4 of the hardware. However it was omitted for the v6, causing a NULL pointer dereference oops on Hamoa/Purwa (X1E/X1P) SoC devices. Fix by adding the appropriate stub.

Fixes add66a6673bc ("phy: qcom: edp: Add Glymur platform support")

Thanks for catching this.

#2 lore raw
In reply to Val Packett
Quoted 28 lines · Val Packett

For Glymur SoC support, the com_clk_fwd_cfg callback was added, and a stub implementation was added for the v4 of the hardware. However it was omitted for the v6, causing a NULL pointer dereference oops on Hamoa/Purwa (X1E/X1P) SoC devices. Fix by adding the appropriate stub.

Fixes add66a6673bc ("phy: qcom: edp: Add Glymur platform support")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/phy/qualcomm/phy-qcom-edp.c +5 -0
index 13feab99feec..a17492db21d8 100644
@@ -613,6 +613,11 @@ static int qcom_edp_phy_com_resetsm_cntrl_v6(const struct qcom_edp *edp)
 				     val, val & BIT(0), 500, 10000);
 }
 
+static int qcom_edp_com_clk_fwd_cfg_v6(const struct qcom_edp *edp)
+{
+	return 0;
+}
+
 static int qcom_edp_com_bias_en_clkbuflr_v6(const struct qcom_edp *edp)
 {
 	/* Turn on BIAS current for PHY/PLL */

drivers/phy/qualcomm/phy-qcom-edp.c static const struct phy_ver_ops qcom_edp_phy_ops_v6 = { · line 766

Quoted 4 lines
drivers/phy/qualcomm/phy-qcom-edp.c +1 -0
@@ -758,6 +763,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 	.com_power_on		= qcom_edp_phy_power_on_v6,
 	.com_resetsm_cntrl	= qcom_edp_phy_com_resetsm_cntrl_v6,
 	.com_bias_en_clkbuflr	= qcom_edp_com_bias_en_clkbuflr_v6,
+	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_v6,

Let's just point it to the existing qcom_edp_com_clk_fwd_cfg_v4

Konrad

#3 lore raw
Quoted 20 lines · Konrad Dybcio
Quoted 19 lines · Val Packett

For Glymur SoC support, the com_clk_fwd_cfg callback was added, and a stub implementation was added for the v4 of the hardware. However it was omitted for the v6, causing a NULL pointer dereference oops on Hamoa/Purwa (X1E/X1P) SoC devices. Fix by adding the appropriate stub.

Fixes add66a6673bc ("phy: qcom: edp: Add Glymur platform support")
---
  drivers/phy/qualcomm/phy-qcom-edp.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/phy/qualcomm/phy-qcom-edp.c +0 -0
index 13feab99feec..a17492db21d8 100644
@@ -613,6 +613,11 @@ static int qcom_edp_phy_com_resetsm_cntrl_v6(const struct qcom_edp *edp)
  				     val, val & BIT(0), 500, 10000);
  }
 
Quoted 15 lines

drivers/phy/qualcomm/phy-qcom-edp.c static const struct phy_ver_ops qcom_edp_phy_ops_v6 = { · line 766

Quoted 13 lines
drivers/phy/qualcomm/phy-qcom-edp.c +6 -0
+static int qcom_edp_com_clk_fwd_cfg_v6(const struct qcom_edp *edp)
+{
+	return 0;
+}
+
  static int qcom_edp_com_bias_en_clkbuflr_v6(const struct qcom_edp *edp)
  {
  	/* Turn on BIAS current for PHY/PLL */
@@ -758,6 +763,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
  	.com_power_on		= qcom_edp_phy_power_on_v6,
  	.com_resetsm_cntrl	= qcom_edp_phy_com_resetsm_cntrl_v6,
  	.com_bias_en_clkbuflr	= qcom_edp_com_bias_en_clkbuflr_v6,
+	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_v6,

Let's just point it to the existing qcom_edp_com_clk_fwd_cfg_v4

Yes

Neil

Quoted 2 lines

Konrad