Skip to content

Commit

Permalink
phy: qcom-qmp-pcie-msm8996: fix init-count imbalance
Browse files Browse the repository at this point in the history
commit e42f110 upstream.

The init counter is not decremented on initialisation errors, which
prevents retrying initialisation.

Add the missing decrement on initialisation errors so that the counter
reflects the state of the device.

Fixes: e78f3d1 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Cc: stable@vger.kernel.org      # 4.12
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230502103810.12061-3-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jhovold authored and gregkh committed Jun 9, 2023
1 parent 5daf7a1 commit 867ad8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static int qmp_pcie_msm8996_com_init(struct qmp_phy *qphy)
ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
if (ret) {
dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);
goto err_unlock;
goto err_decrement_count;
}

ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets);
Expand Down Expand Up @@ -455,7 +455,8 @@ static int qmp_pcie_msm8996_com_init(struct qmp_phy *qphy)
reset_control_bulk_assert(cfg->num_resets, qmp->resets);
err_disable_regulators:
regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
err_unlock:
err_decrement_count:
qmp->init_count--;
mutex_unlock(&qmp->phy_mutex);

return ret;
Expand Down

0 comments on commit 867ad8c

Please sign in to comment.