* [PATCH v1] pci: qcom: Fix 'opp' variable usage
@ 2024-07-09 6:36 Varadarajan Narayanan
2024-07-09 7:09 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Varadarajan Narayanan @ 2024-07-09 6:36 UTC (permalink / raw)
To: manivannan.sadhasivam, lpieralisi, kw, robh, bhelgaas,
quic_krichai, linux-pci, linux-arm-msm, linux-kernel
Cc: Varadarajan Narayanan
qcom_pcie_icc_opp_update() calls 'dev_pm_opp_put(opp)' regardless
of the success of dev_pm_opp_find_freq_exact().
If dev_pm_opp_find_freq_exact() had failed and 'opp' had some
error value, the subsequent dev_pm_opp_put(opp) results in a
crash. Hence call dev_pm_opp_put(opp) only if 'opp' has a valid
value.
Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance")
Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
---
drivers/pci/controller/dwc/pcie-qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 26405fcfa499..2a80d4499c25 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1443,8 +1443,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);
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] pci: qcom: Fix 'opp' variable usage
2024-07-09 6:36 [PATCH v1] pci: qcom: Fix 'opp' variable usage Varadarajan Narayanan
@ 2024-07-09 7:09 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2024-07-09 7:09 UTC (permalink / raw)
To: Varadarajan Narayanan
Cc: lpieralisi, kw, robh, bhelgaas, quic_krichai, linux-pci,
linux-arm-msm, linux-kernel
On Tue, Jul 09, 2024 at 12:06:20PM +0530, Varadarajan Narayanan wrote:
> qcom_pcie_icc_opp_update() calls 'dev_pm_opp_put(opp)' regardless
> of the success of dev_pm_opp_find_freq_exact().
>
> If dev_pm_opp_find_freq_exact() had failed and 'opp' had some
> error value, the subsequent dev_pm_opp_put(opp) results in a
> crash. Hence call dev_pm_opp_put(opp) only if 'opp' has a valid
> value.
>
> Fixes: 78b5f6f8855e ("PCI: qcom: Add OPP support to scale performance")
> Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Fix was already submitted: https://lore.kernel.org/linux-pci/20240708180539.1447307-3-dan.carpenter@linaro.org/
- Mani
> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 26405fcfa499..2a80d4499c25 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1443,8 +1443,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);
> }
> }
>
> --
> 2.34.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-09 7:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 6:36 [PATCH v1] pci: qcom: Fix 'opp' variable usage Varadarajan Narayanan
2024-07-09 7:09 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox