Commit 9553636b authored by Dan Carpenter's avatar Dan Carpenter Committed by Krzysztof Wilczyński

PCI: qcom: Prevent potential error pointer dereference

Only call dev_pm_opp_put() if dev_pm_opp_find_freq_exact() succeeds;
otherwise it leads to an error pointer dereference.

Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance")
Link: https://lore.kernel.org/linux-pci/20240708180539.1447307-3-dan.carpenter@linaro.orgSigned-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarKrzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
parent 101e5c5c
...@@ -1447,8 +1447,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie) ...@@ -1447,8 +1447,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie)
if (ret) if (ret)
dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n", dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n",
freq_kbps * width, ret); freq_kbps * width, ret);
dev_pm_opp_put(opp);
} }
dev_pm_opp_put(opp);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment