Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08fae6be authored by raghavendra ambadas's avatar raghavendra ambadas
Browse files

msm: mhl: sii8334: Fix null pointer dereference at power off



Check for null pointer before disabling the regulators.
During cable connect/disconnect and suspend/resume check for
previous power state of mhl to avoid enabling/disabling gpio's
and regulators twice.

Change-Id: I44dc51122da4630974147b829236cb39c1ad54b0
Signed-off-by: default avatarRaghavendra Ambadas <rambad@codeaurora.org>
parent f19ef0f6
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ static int mhl_sii_config(struct mhl_tx_ctrl *mhl_ctrl, bool on)

	client = mhl_ctrl->i2c_handle;

	if (on) {
	if (on && !mhl_ctrl->irq_req_done) {
		rc = mhl_vreg_config(mhl_ctrl, 1);
		if (rc) {
			pr_err("%s: vreg init failed [%d]\n",
@@ -424,7 +424,7 @@ static int mhl_sii_config(struct mhl_tx_ctrl *mhl_ctrl, bool on)
		} else {
			mhl_ctrl->irq_req_done = true;
		}
	} else {
	} else if (!on && mhl_ctrl->irq_req_done) {
		free_irq(mhl_ctrl->i2c_handle->irq, mhl_ctrl);
		mhl_gpio_config(mhl_ctrl, 0);
		mhl_vreg_config(mhl_ctrl, 0);
@@ -1533,22 +1533,29 @@ static int mhl_sii_reg_config(struct i2c_client *client, bool enable)
	pr_debug("%s\n", __func__);

	if (!enable) {
		if (reg_8941_vdda) {
			regulator_disable(reg_8941_vdda);
			regulator_put(reg_8941_vdda);
			reg_8941_vdda = NULL;
		}

		if (reg_8941_smps3a) {
			regulator_disable(reg_8941_smps3a);
			regulator_put(reg_8941_smps3a);
			reg_8941_smps3a = NULL;
		}

		if (reg_8941_l02) {
			regulator_disable(reg_8941_l02);
			regulator_put(reg_8941_l02);
			reg_8941_l02 = NULL;
		}

		if (reg_8941_l24) {
			regulator_disable(reg_8941_l24);
			regulator_put(reg_8941_l24);
			reg_8941_l24 = NULL;

		}
		return 0;
	}