summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-07-08 13:05:37 -0500
committerKrzysztof Wilczyński <kwilczynski@kernel.org>2024-07-10 05:39:11 +0000
commit9553636b5757789536d0d23c83e7fba11812f958 (patch)
tree11cfe219ec211f7268b32e864a318b843bbebc9c /drivers/pci
parent101e5c5c4e766901492b51c33b34af5f775b043f (diff)
downloadlwn-9553636b5757789536d0d23c83e7fba11812f958.tar.gz
lwn-9553636b5757789536d0d23c83e7fba11812f958.zip
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.org Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Anders Roxell <anders.roxell@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/controller/dwc/pcie-qcom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 067ccb9cc6d0..5973df2238b0 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1447,8 +1447,8 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie)
if (ret)
dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n",
freq_kbps * width, ret);
+ dev_pm_opp_put(opp);
}
- dev_pm_opp_put(opp);
}
}